Monday, February 2, 2009

Retrieving the Web Service Version

The Web service version is needed to support ISV applications that can easily detect and work with multiple versions of Microsoft Dynamics CRM. The RetrieveVersion message provides support for determining the version, or build number, of the Microsoft Dynamics CRM software installed on the server.
Example : The following code retrieves the version of the server software and produces output like this: "4.0.7283.0"

// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

RetrieveVersionRequest versionRequest = new RetrieveVersionRequest();
RetrieveVersionResponse versionResponse = (RetrieveVersionResponse)service.Execute(versionRequest);

No comments: