The quickest way to get the ID of the current CRM User with .NET

In case you have ever wondered or needed to know, here is how you get the ID of the current user using .NET (C# in this case):

var whoAmIResponse = (WhoAmIResponse)OrganizationService.Execute(new WhoAmIRequest());

var currentUser = new EntityReference(SystemUser.EntityLogicalName, whoAmIResponse.UserId);

Leave a Reply 0 comments