private EntityCollection GetUserSecurityRole(Guid userGuid, IOrganizationService service)
{
var query = new QueryExpression
{
LinkEntities =
{
new LinkEntity
{
LinkFromEntityName = "role",
LinkFromAttributeName = "roleid",
LinkToEntityName = "systemuserroles",
LinkToAttributeName = "roleid",
LinkCriteria = new FilterExpression
{
FilterOperator =LogicalOperator.And,
Conditions =
{
new ConditionExpression
{
AttributeName = "systemuserid",
Operator = ConditionOperator.Equal,
Values =
{
userGuid
}
}
}
}
}
},
ColumnSet = new ColumnSet(true),
EntityName = "role"
};
var userRoles = service.RetrieveMultiple(query);
return userRoles;
}
No comments:
Post a Comment