web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Hi, help me to write connection part(credential part) of console application for CRM 2011

(0) ShareShare
ReportReport
Posted on by 2,654

I am unable to connect . Here is code .

CODE:

OrganizationServiceProxy proxy;

           ClientCredentials deviceCredentials = null;

           ClientCredentials clientCredentials = null;

           Guid contactId = Guid.Empty;

           //Organization URL

           Uri OrganizationUri = new Uri("crm14.api.crm5.dynamics.com/.../Organization.svc");

           //Discovery URL

           Uri HomeRealmUri = new Uri("disco.crm5.dynamics.com/.../Discovery.svc");

           //Setting Client Credentials

           clientCredentials = GetCredentials("kar.ayush@crm14.onmicrosoft.com", "ayush.9255");

           //Get the Device Id and Password

           deviceCredentials = GetDeviceCredentials();

           //Using Organization Service Proxy to instantiate the CRM Web Service

           using (proxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, clientCredentials, deviceCredentials))

           {

               // This statement is required to enable early-bound type support.

               proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());

               IOrganizationService service = (IOrganizationService)proxy;

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ScottDurow Profile Picture
    23 on at

    Hi,

    I recommend using the CrmConnection class in the SDK - this makes it far easier. I did a post about it here - develop1.net/.../MicrosoftXrmClient-Part-2.aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans