We will connect to Dynamics 365 from a console app using the Organization Service Proxy.
To do this, create a new console app.
Add the assemblies:
- Microsoft.Xrm.Sdk
- System.ServiceModel (for ClientCredentials)
We will also add Microsoft.Crm.Sdk.Proxy to get the version info from Dynamics 365.
Add using statements:
- using Microsoft.Xrm.Sdk.Client;
- using System.ServiceModel.Description;
- using Microsoft.Crm.Sdk.Messages;
Now the code to connect to Dynamics 365:
using System;
using System.Linq;
using Microsoft.Xrm.Sdk.Client;
using System.ServiceModel.Description;
using Microsoft.Crm.Sdk.Messages;
namespace Carl.Crm.OrgServiceProxy
{
class Program
{
static void Main(string[] args)
{
try
{
Uri oUri = new Uri("https://yourcrm.crm.dynamics.com/XRMServices/2011/Organization.svc");
ClientCredentials clientCredentials = new ClientCredentials();
clientCredentials.UserName.UserName = "your@email.com";
clientCredentials.UserName.Password = "yourpassword";
OrganizationServiceProxy _serviceProxy = new OrganizationServiceProxy(oUri, null, clientCredentials, null);
_serviceProxy.EnableProxyTypes();
OrganizationServiceContext orgContext = new OrganizationServiceContext(_serviceProxy);
RetrieveVersionRequest versionRequest = new RetrieveVersionRequest();
RetrieveVersionResponse versionResponse = (RetrieveVersionResponse)_serviceProxy.Execute(versionRequest);
Console.WriteLine("Microsoft Dynamics CRM version {0}.", versionResponse.Version);
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.ReadLine();
}
}
}
This returns:
![]()

Keep learning. Keep building.
Explore AI, agents & Microsoft technology.
I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.
Subscribe on YouTube →Carl de Souza Enterprise Architect at Microsoft · AI Technology Expert

Hi Carl,
Is connecting to CRM Service Proxy is deprecated now.
Also, does that mean we cannot use LINQ with Dynamics 365 anymore.
Thanks,