Description:
How to Establish a connection between Dataverse and Console Application’
Works with Microsoft Office 365
Solution:
1. Open Visual Studio
2. Search for .Net Framework
3. Select Next
4. Input your Name and Click Create
5. It will Create a Console Application Project
6. Once Created Input the Below Code
try
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
CrmServiceClient conn = CrmServiceClient(ConfigurationManager.ConnectionStrings["Xrm"].ConnectionString.Decrypt());
conn = new CrmServiceClient("AuthType=Office365;Url=https://URL.crm4.dynamics.com/;Username=USERNAME;Password=PASSWORD;RequireNewInstance=True");
if (conn.IsReady)
{
// Connection Established
}
else{
// Connection Not Established
}
return conn;
}
catch (Exception ex)
{
throw;
}
7. Once you pasted above code you will get error like below (ITS because of Missing Assembly)
8. Right Click on the error CRMServiceClient you will get Quick Actions Select and Select Install Package Microsoft.CrmSdk.XrmTooling.CoreAssembly
9. Once Done it will automatically install all the Respective Assembly