Example of WhoAmI for Microsoft Dynamic CRM 4.0
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "OrganizationName";
CrmService pService = new CrmService(); // optional to set url parameter
pService.CrmAuthenticationTokenValue = token;
pService.Credentials = CredentialCache.DefaultCredentials;
WhoAmIRequest request = new WhoAmIRequest();
WhoAmIResponse oSystem= (WhoAmIResponse)pService.Execute(request);
//oSystem.UserId;
//oSystem.OrganizationId ;//
Thanks,
Rami Heleg.