Thursday, September 10, 2009

Create Crm Service example based systemuser and organization

Here function to create Crm Service example for specific systemuser and organization name

public static CrmService GetCrmService(Guid callerID,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;
token.CallerId = callerID;
rslt.CrmAuthenticationTokenValue = token;
rslt.Credentials =CredentialCache.DefaultCredentials;
return rslt;
}

Enjoy,
Rami Heleg