Connect Dynamics CE using ClientID and ClientSecret

 /*Connection establishing using ClientID & Client Secret*/

public static void GetConnection()

        {

            try

            {

                string connectionString = "AuthType=ClientSecret; url=REPLACE WITH ORANIZATION URL; ClientId=REPLACE WITH YOUR CLIENT ID; ClientSecret=REPLACE WITH YOUR CLIENT SECRET";

                crmServiceClient = new CrmServiceClient(connectionString); //Connecting to the D-365 CDS instance


                if (crmServiceClient != null && crmServiceClient.IsReady)

                {

                    Console.WriteLine("\nConnection successful.");

                }

                else

                {

                    Console.WriteLine("\nPlease make sure the Connection String is correct.");

                }

            }

            catch (Exception ex)

            {

                throw new Exception(ex.Message);

            }

        }

Comments

Popular posts from this blog

Connecting Dynamics 365 Web api using external HTML page

Get azure blob files inside Sub Directories

Interview questions on MS CRM