Simple Code to connect to MS D365 Online using console Application

Install Libraries via Nuget :

Install-Package Microsoft.CrmSdk.CoreAssemblies
Install-Package Microsoft.CrmSdk.XrmTooling.CoreAssembly


static void Main(string[] args)
 {
 CrmServiceClient crmServiceClientObj = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CrmOnlineStringFromAppConfig"].ConnectionString);
 if (!crmServiceClientObj .IsReady)
 Console.WriteLine("No Connection was Made.");
 Console.WriteLine("Connected");

}

now only thing here to think of is what will be the value of key CrmOnlineStringFromAppConfig in app.config


how to get all the three properties of Connection string

  1. Url :
    1. Login to CRM online instance
    2. go to setting > customization
    3. Click Developer Resources
    4. you will see connect your app to this instance section and in that instance web api is what you should use to connect to CRM instance a.png
    5. Take this Url and fill your first property of CRM connection string
  2. Other two properties are User id is ur email id and password you just used to login in CRM online instance.

Hope this help to get started.

Explore methods of crmServiceClientObj  object

Thank you.

Regards,
Friyank Parikh.

9 thoughts on “Simple Code to connect to MS D365 Online using console Application

  1. Pingback: Friyank's Blog

Leave a comment