Michael Philip's Blog

Writing about MS Tech with strong focus on Azure & CRM

Connect to Dynamics 365 using C# SDK

Leave a comment

Hi,

I am going to show  in a few steps how to create an organization service proxy for dynamics 365 .

Steps :

  • Create a new project in visual studio
  • Add nuget package :”Microsoft.CrmSdk.CoreAssemblies
    •  “Install-Package NuGet.CommandLine”
  • Add the following piece of code

CrmServiceClient conn = new CrmServiceClient(“Url=https://moqcrm20.crm6.dynamics.com/; Username=test; Password=test; authtype=Office365”);

// Cast the proxy client to the IOrganizationService interface.
var _orgService = (Microsoft.Xrm.Sdk.IOrganizationService)conn.OrganizationWebProxyClient != null ? (Microsoft.Xrm.Sdk.IOrganizationService)conn.OrganizationWebProxyClient : (Microsoft.Xrm.Sdk.IOrganizationService)conn.OrganizationServiceProxy;

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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