//createdby - user 1 //owner - user 2 //impersonate - crm-service CrmAuthenticationToken token = new CrmAuthenticationToken(); token.AuthenticationType = 0; // Use Active Directory authentication. token.OrganizationName = "LP"; // Use the global user ID of the system user that is to be impersonated. token.CallerId = new Guid("C0C0A8E9-A72D-E011-80B9-00155DC85005"); //user 1 CrmService crmService = new CrmService(); crmService.Url = "http://tl:5555/MSCRMServices/2007/CrmService.asmx"; crmService.CrmAuthenticationTokenValue = token; crmService.Credentials = new System.Net.NetworkCredential("CRM-Service", "Password2k", "company"); // Create a new account owned by the impersonated user. account account = new account(); account.name = "Fabrikam !!"; Owner owner = new Owner(); owner.Value = new Guid("D57CC3F3-A92D-E011-80B9-00155DC85005"); //user 2 owner.type = EntityName.systemuser.ToString(); account.ownerid = owner; Guid accountid = crmService.Create(account);
Search
Tuesday, February 1, 2011
Impersonation
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment