cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sat_van
Helper I
Helper I

E-mail notifications to all the users of a shared folder on SharePoint

I am trying to create a flow that notifies all users who have access to a certain folder on the SharePoint when a new file is added to that folder.

I know that there is a template for E-mail notifications but I can't figure out how to extract the E-mails of all users who have access to that folder to include in that "To" field of the template.

The users' access rights to the folder can change over time.

Does anyone know how to achieve this?

2 ACCEPTED SOLUTIONS

Accepted Solutions
PrasadAthalye
Super User
Super User

@sat_van - Is there any way you can create a SharePoint group and add all of the users in that group and grant access to group on the folder? Then you can just query memberships of the group and send email... This is always a recommended approach that item level permissions.

 

Like and Mark this  as answer if it resolves your issue.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

v-litu-msft
Community Support
Community Support

Hi @sat_van,

 

1. The method gets members of a shared folder is using the HTTP request to get it, uri as below:

_api/web/GetFolderByServerRelativeUrl('FolderPath')/?$expand=ListItemAllFields/RoleAssignments/Member/Users

Screenshot 2020-10-14 105013.jpg

2. Then use an expression to get property "SharedWithDetails":

outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']?['ListItemAllFields']?['SharedWithDetails']

 

Screenshot 2020-10-14 105042.jpg

3. Return value is a string, we should use split() function and filter array action to remove useless characters. Only remains the item contains "i:0#.f|membership|"

Screenshot 2020-10-14 105101.jpg

 4. Then use join to combine members to a string, and remove "i:0#.f|membership|" to let it could be used in the Send email to field.

Screenshot 2020-10-14 105141.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
PrasadAthalye
Super User
Super User

@sat_van - Is there any way you can create a SharePoint group and add all of the users in that group and grant access to group on the folder? Then you can just query memberships of the group and send email... This is always a recommended approach that item level permissions.

 

Like and Mark this  as answer if it resolves your issue.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

v-litu-msft
Community Support
Community Support

Hi @sat_van,

 

1. The method gets members of a shared folder is using the HTTP request to get it, uri as below:

_api/web/GetFolderByServerRelativeUrl('FolderPath')/?$expand=ListItemAllFields/RoleAssignments/Member/Users

Screenshot 2020-10-14 105013.jpg

2. Then use an expression to get property "SharedWithDetails":

outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']?['ListItemAllFields']?['SharedWithDetails']

 

Screenshot 2020-10-14 105042.jpg

3. Return value is a string, we should use split() function and filter array action to remove useless characters. Only remains the item contains "i:0#.f|membership|"

Screenshot 2020-10-14 105101.jpg

 4. Then use join to combine members to a string, and remove "i:0#.f|membership|" to let it could be used in the Send email to field.

Screenshot 2020-10-14 105141.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@PrasadAthalye Thank you very much for your response. This is probably the easiest way. I think the List Group Members action should work even when I'm not the admin of that SharePoint Group, am I right?

@v-litu-msft Thanks, I'll give it a go though looks a bit complicated for me.

@sat_van - Yes it should. Just configure Properties of the group to display membership to everyone. 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Hi

Thanks for this post. It helped me solve a problem I asked here

https://powerusers.microsoft.com/t5/Building-Flows/How-to-read-a-Sharepoint-Folder-unique-permission...

 

I have read some more sophisticated ways of splitting the string but yours is both  more PowerApp oriented and also easier to debug as you can see intermediate content

More i have added some filter to remove invalid users (users that left the company but their email is still there)

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (22,687)