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

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
Solution Specialist
Solution Specialist

@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

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

5 REPLIES 5
Solution Specialist
Solution Specialist

@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

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

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (7,965)