cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
leemc
Frequent Visitor

Get group members dynamically based on groups selected in library column

Hi, I have a library that I need to assign item level permissions on. In order to grant permission to the correct group, I have created a People picker column (groups allowed).  Column name is "Target groups". Some items may have multiple groups assigned permissions on them. At the moment these groups are AD security groups, synced to M365, but I could just as easily create SharePoint groups.

leemc_2-1610463323312.png


When I hardcode the group name (eg. TestGroup) into my "Send an HTTP request to SharePoint", the request is successful, but when I try to dynamically get the group members based on the group entered in the "Target groups" column, the operation never completes.

This completes successfully:

leemc_1-1610463084868.png

 

This does not end:

leemc_0-1610462892770.png

 

Is there any other way to dynamically get group members

 

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @leemc,

 

If it's a single AD security group per field you could use the claims value of the Target Groups field.

 

Add a Get group members action to your flow and use the following expression. Btw, in my example below I am collecting the value via a Get items action.

 

split(outputs('Get_items')?['body/value'][0]['Targetgroups'][0]['Claims'], 't|')?[1]

 

 

getgroupmembers.png

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


tom_riha
Super User
Super User

Hello @leemc ,

does the dynamic content 'Target groups' you use inside the 'Apply to each' contain only the group name? If you store it into a 'Compose' action inside the loop, does it contain only the group name?



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,978)