Connect to Microsoft Dynamics CRM using Visual Studio

Post Date: September 20, 2015

Microsoft Dynamics Consultant

[vc_row][vc_column][vc_column_text]

Summary

[/vc_column_text][vc_column_text]This article demonstrates how to connect to Microsoft Dynamics CRM using the Microsoft Dynamics CRM Developer Toolkit found in the CRM SDK. The toolkit uses the Discovery Service Endpoint to establish a connection.

From Microsoft SDK:

The IDiscoveryService Web service is used to determine the organizations that a user is a member of, and the endpoint address URL to access the IOrganizationService Web service for each of those organizations. This discovery service is necessary because Microsoft Dynamics CRM is a multi-tenant environment—a single Microsoft Dynamics CRM server can host multiple business organizations. By using the discovery Web service, your application can determine the endpoint address URL to access the target organization’s business data.

For Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online 2015 Update installations, server and organization allocation may change as part of datacenter management and load balancing. Therefore, the IDiscoveryService Web service provides a way to discover which Microsoft Dynamics CRM server is serving your organization at a given time.

 

Discover the URL for your organization with IDiscoveryService web service https://msdn.microsoft.com/en-gb/library/gg328127.aspx[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_empty_space height=”50px”][vc_tta_tour style=”flat” shape=”square” color=”white” active_section=”1″ pagination_style=”outline-square”][vc_tta_section i_type=”entypo” i_icon_entypo=”entypo-icon entypo-icon-list” title=”All CRM Versions” tab_id=”1442495611238-ee95482a-bfaf” add_icon=”true”][vc_wp_text]The following table lists the Web service URLs for the worldwide Microsoft Dynamics CRM Online data centers.

Location Discovery Web service URL Identity Provider
North America https://dev.crm.dynamics.com/XRMServices/2011/Discovery.svc Microsoft account
https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc Microsoft Office 365
North America 2 https://disco.crm9.dynamics.com/XRMServices/2011/Discovery.svc Microsoft Office 365
Europe, Middle East and Africa (EMEA) https://dev.crm4.dynamics.com/XRMServices/2011/Discovery.svc Microsoft account
https://disco.crm4.dynamics.com/XRMServices/2011/Discovery.svc Microsoft Office 365
Asia Pacific Area (APAC) https://dev.crm5.dynamics.com/XRMServices/2011/Discovery.svc Microsoft account
https://disco.crm5.dynamics.com/XRMServices/2011/Discovery.svc Microsoft Office 365
Oceania https://disco.crm6.dynamics.com/XRMServices/2011/Discovery.svc Microsoft Office 365
Japan (JPN) https://disco.crm7.dynamics.com/XRMServices/2011/Discovery.svc Microsoft Office 365
South America https://disco.crm2.dynamics.com/XRMServices/2011/Discovery.svc Microsoft Office 365

For an Internet-facing deployment (IFD) installation, the Web service URL has the following form:

For an on-premises installation, the web service URL has the following form:

Consult the Developer Resources page in the Microsoft Dynamics CRM Web application for the correct URL of your installation.

To use the IDiscoveryService Web service, add a reference to the Microsoft.Xrm.Sdk.dll assembly to your Microsoft Visual Studio project, and then add a using or imports statement to access the Microsoft.Xrm.Sdk.Discovery namespace. Alternatively, you can add the service references for the URLs described previously to your project.[/vc_wp_text][/vc_tta_section][vc_tta_section i_type=”entypo” i_icon_entypo=”entypo-icon entypo-icon-cloud” title=”CRM Online” tab_id=”1442495611505-cbeedd4c-16c2″ add_icon=”true”][vc_wp_text]No additional information.[/vc_wp_text][/vc_tta_section][vc_tta_section i_type=”entypo” i_icon_entypo=”entypo-icon entypo-icon-window” title=”CRM 2015″ tab_id=”1442496022218-4dd20bc3-7533″ add_icon=”true”][vc_wp_text]No additional information.[/vc_wp_text][/vc_tta_section][vc_tta_section i_type=”entypo” i_icon_entypo=”entypo-icon entypo-icon-window” title=”CRM 2013″ tab_id=”1442496335186-5e4f4bc4-402a” add_icon=”true”][vc_wp_text]No additional information.[/vc_wp_text][/vc_tta_section][vc_tta_section i_type=”entypo” i_icon_entypo=”entypo-icon entypo-icon-window” title=”CRM 2011″ tab_id=”1442496419797-706fdec6-fc02″ add_icon=”true”][vc_wp_text]No additional information.[/vc_wp_text][/vc_tta_section][vc_tta_section i_type=”entypo” i_icon_entypo=”entypo-icon entypo-icon-window” title=”CRM 4.0″ tab_id=”1442496435635-9ae9731d-8f14″ add_icon=”true”][vc_wp_text]No additional information.[/vc_wp_text][/vc_tta_section][vc_tta_section i_type=”entypo” i_icon_entypo=”entypo-icon entypo-icon-window” title=”CRM 3.0″ tab_id=”1442496477171-9e040e88-99e9″ add_icon=”true”][vc_wp_text]No additional information.[/vc_wp_text][/vc_tta_section][vc_tta_section i_type=”entypo” i_icon_entypo=”entypo-icon entypo-icon-pencil” title=”Notes” tab_id=”1442496506693-a852e2a4-68c6″ add_icon=”true”][vc_wp_text]No additional notes.[/vc_wp_text][/vc_tta_section][/vc_tta_tour][vc_empty_space height=”50px”][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]

Further Reading

[/vc_column_text][vc_column_text]Microsoft Dynamics CRM Developer Toolkit https://msdn.microsoft.com/en-us/library/hh372957(v=crm.6).aspx

Discover the URL for your organization with IDiscoveryService web service https://msdn.microsoft.com/en-gb/library/gg328127.aspx[/vc_column_text][vc_empty_space height=”60px”][/vc_column][/vc_row]

Leave a Reply