Friday, October 19, 2007

How to Identify the currently logged in user using the MSCRM service

I needed to build a custom CRM page that would be hosted within the crm 3.0 environment, it need to be accessed via the navigation pane. Given that requirement the page need to find out which user was logged in.

using the the webservice do the following:

WhoAmIRequest whoAmI = new WhoAmIRequest();
WhoAmIResponse Iam = (WhoAmIResponse)service.Execute(whoAmI);
Guid userid = Iam.UserId;


The WhoAmIResponse includes also includes the business unit belonging to the user.

Oshri Cohen

Labels: , , , , , , , ,