Thursday, September 10, 2009

Create CrmService example

here function to create crmService based organization Name.

public static CrmService GetCrmService(string organizationName) {
CrmService rslt = new CrmService();
rslt.Url = "http://localhost:5555/MSCRMServices/2007/CrmService.asmx";
CrmServiceSdk.CrmAuthenticationToken token = new CrmServiceSdk.CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = organizationName;
rslt.CrmAuthenticationTokenValue = token;
rslt.Credentials =CredentialCache.DefaultCredentials;
return rslt;
}

Enjoy,
Rami heleg