web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / HIMBAP / Get All users based on Busi...

Get All users based on Business Unit -MS CRM 2011

Mahendar Pal Profile Picture Mahendar Pal 45,095

If you are looking for a code to get all the users for a particular business unit, you can use below code

private EntityCollection RetrieveUserBasedOnBusinessUnit(IOrganizationService _CrmService,Guid BUId)
        {
            QueryExpression _Query = new QueryExpression
                   {
                       EntityName = “systemuser”,
                       ColumnSet = new ColumnSet(true),
                       Criteria =
                       {
                          Conditions =
                        {
                            new ConditionExpression
                            {
                                AttributeName=”businessunitid”,
                                Operator=ConditionOperator.Equal,
                                Values={BUId}

                            }
                        }
                       }
                   };
            return _CrmService.RetrieveMultiple(_Query);
        }
Enjoy !!!


Comments

*This post is locked for comments