This blog is about getting all CRM users based on business unit ID.
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);
}
Hope this will help someone.

Join the conversation! Your thoughts help the community grow.