Is it a Person or Group
Wondering if there's a way to determine if a Person/Group field is a person or a group. I'm using the functionality from the article
How to get email addresses from SharePoint group members – skybow Portal and it works great for a group, but if it's a person I want to return [[PersonField.email]]. My solution is to check if the email has an @ and if it does then I assume person, otherwise a group. Just wondering if there's a better way.
-
Hi Dale
In my case of getting all members of a SP group including members of nested AAD groups, I'm using Graph API for accessing the AAD group members. In that case I'm checking if the email of the returned "user" is empty. When user.Email is available -> it's a user. When it's an empty string -> it's a security group and I proceed to get all members of this AAD security group.var result = [];
var responseResult = [[@Actions.Send_HTTP_request_get_all_members_of_SP_group.ResponseBody]].d.results;
if(responseResult.length > 0){
responseResult.forEach(user => {
if(user.Email != ""){
result.push({"DisplayName": user.Title, "Email": user.Email});
}
});
}
return result;0
Please sign in to leave a comment.
Comments
1 comment