How to quickly connect to Dynamics CRM/365 (online-onprem) using C#?
Note: for this walkthrough I’ve been using ConsoleApplication Step 1: Add following .Net references: System.Runtime.Serialization System.ServiceModel Step 2: Add following references available in Bin folder of the SDK Microsoft.Xrm.Sdk Microsoft.Crm.Sdk.Portal Step 3: Add following namespaces in your class file using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Description; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Client; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Discovery; using Microsoft.Crm.Sdk.Messages; Step 4: Create a method EstablishConnetionWithCRM with following three parameters: UserName - Provide O365 Userid in case of online CRM, for on-prem proivde doamin\username Password - Provide Password ServiceUrl - Provide Organization Service URL by going through f