Creating CRM Organisation Service

Creating CRM Organisation Service :

Connecting to dynamics CRM through API with service proxy

// Credentials

 string username = "";
 string password = "xxxxxx";
 string url="";
 Uri organisationurl = new Uri(url);
 ClientCredentials credentials = new ClientCredentials();
 credentials.UserName.UserName = username;
 credentials.UserName.Password = password;
 OrganizationServiceProxy service = new OrganizationServiceProxy(organisationurl, null, credentials, null);
 service.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());


OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);
IOrganizationService service = (IOrganizationService)proxy;

// It will connected and enjoy

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s