CrmService _service = new CrmService();
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.OrganizationName = orgName;
token.AuthenticationType = AuthenticationType.AD;
_service.Url = "http://localhost:5555/MSCRMServices/2007/crmservice.asmx";
_service.CrmAuthenticationTokenValue = token;
//_service.Credentials = new System.Net.NetworkCredential() { UserName = "username", Password = "password" };
_service.Credentials = System.Net.CredentialCache.DefaultCredentials;
WhoAmIRequest req = new WhoAmIRequest();
WhoAmIResponse res = (WhoAmIResponse)_service.Execute(req);
Guid userID= res.UserId;
After getting UserId get the whole information by TargetRetrieved or Query;
No comments:
Post a Comment