Inside sharepoint i have a People or Group field named Approvers, which accept People and Groups, as follow:-
now i am sending approval emails to all the values inside this field as follow:-
Now the above will work incase the Approvers field only contain individual users. but will fail if the Approvers field contain Groups (SP Group or Office 365 group).. now i know that i can iterate through the members of the sharepoint group or through the members of an office 365 group using different approaches.. but what i am failing to understand if how i can differentiate if the Approvers field values are User, SP Group or Office 365 group?? and i need to know the value type so i can implement the related approach to iterate through the users' emails? for example let say on a scenario the Approvers field contain 3 values; user, SP group & Office 365 group >> then i need to pass each value to a different step to retrieve the related email/s..
any advice on this please?
Thanks
Hi @johnjohn123,
Yes, that is correct. It would look similar to the example below.
I am using the following expression in the condition btw
outputs('Send_an_HTTP_request_to_SharePoint')?['body/d/results']?[0]?['ContentTypeId']
@Expiscornovusthanks for the reply.. so using the first http request i can get the contenttypeid and do the comparison is this correct?
@johnjohn123, you are correct, you would not need both actions. I just wanted it to work with the Content Type name label, but of course you can only the ContentTypeId value from the Send an http request to SharePoint action which makes the HTTP action obsolete.
I wanted to test if it was possible with both the HTTP and Send to HTTP request to SharePoint actions 😁
@ExpiscornovusThanks a lot for the detailed reply and useful info.,. but i did not get why i need to create an HTTP action and also create an application inside azure to integrate with the graph API? can not i just use the first http request (to the user info list) to get what i need (the contenttype) ?
Thanks
Hi @johnjohn123,
Below is an example. This sample works with the User Information List. This list has a contentType field which has an id and name value. I am retrieving that for the responding user id.
Person | 0x010A006603494A2872EC40828E561B63983E85 |
DomainGroup | 0x010C006D33AC37EFFB214097F6A4789A8640A3 |
SharePointGroup | 0x010B00B19F88BC05982C42B0270CB765006B4C |
1. Add a Send an HTTP request to SharePoint action within the apply to each loop. Use the display name of the approver to retrieve the correct user id. Use the following value for the URI field.
_api/Web/SiteUserInfoList/Items?&$filter=Title eq '@{items('Apply_to_each')?['DisplayName']}'
2. Add an HTTP action. For this action you will need to register an App in Azure AD though for the permissions and the authentication. Lee Ford has a nice blog about this, https://www.lee-ford.co.uk/using-flow-with-graph-api/
Use the following value for the URI for the Graph Get request.
https://graph.microsoft.com/v1.0/sites/@{variables('SiteId')}/lists('User%20Information%20List')/items('@{outputs('Send_an_HTTP_request_to_SharePoint')?['body/d/results']?[0]?['Id']}')?$select=id,contenttype,name
3. Add a condition action to check if it is a user. I am using the following expression to check if it is a person
outputs('HTTP')?['body/contentType/name']
is equal to Person
4. Repeats this if you also want to check for the DomainGroup and/or SharePointGroup.
The end result should look a bit similar like this.
Hi @johnjohn123,
Had to do some research.
It looks like the Graph API could be a potential solution approach. In this thread they are showing how you can collect the contentType/name value from the User Information List of the related SharePoint site, which contains values like DomainGroup, Person and SharePointGroup.
Working on a sample 🙂
@Expiscornovus ok thanks for this help.. but how i can determine if the group is sharepoint group or office 365 group?
also second question, how i can get the claims inside my MS Flow? to check its values?
Hi @johnjohn123,
You could collect this logic from the claims value. Below is an example of an Approvers array which contains three person or group objects (user, sp group and O365 group).
"Approvers": [
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "i:0#.f|membership|jane@contoso.onmicrosoft.com",
"DisplayName": "Jane Doe",
"Email": "jane@contoso.onmicrosoft.com",
"Picture": "",
"Department": "Sales",
"JobTitle": "Account Manager"
},
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "c:0o.c|federateddirectoryclaimprovider|randomguid",
"DisplayName": "806590 Members",
"Email": "806590@contoso.onmicrosoft.com",
"Picture": "",
"Department": null,
"JobTitle": null
},
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "c:0o.c|federateddirectoryclaimprovider|randomguid",
"DisplayName": "Office 365 Group",
"Email": "Office365Group@contoso.onmicrosoft.com",
"Picture": "",
"Department": null,
"JobTitle": null
}
]
As you can see the difference is the first part of the Claims value. So you could use that to determine if it is a user by using an expression and the startswith function. If the output of that expression is true you will know it is an user.
Below is an example of that expression for this check within an apply to each.
startswith(items('Apply_to_each')?['Claims'], 'i:0#.f|membership|')
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492