首页 > 代码库 > crm2011通过服务得到当前用户id

crm2011通过服务得到当前用户id

public Guid GetUserIdByOrganizationService(IOrganizationService service)
        {
            var userRequest = new WhoAmIRequest();
            var userResponse = (WhoAmIResponse)service.Execute(userRequest);
            return userResponse.UserId;
        }