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?
Solved! Go to Solution.
@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.
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
2. Then use an expression to get property "SharedWithDetails":
outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']?['ListItemAllFields']?['SharedWithDetails']
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|"
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.
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.
@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.
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
2. Then use an expression to get property "SharedWithDetails":
outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']?['ListItemAllFields']?['SharedWithDetails']
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|"
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.
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.
@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?
@sat_van - Yes it should. Just configure Properties of the group to display membership to everyone.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
41 | |
40 | |
37 | |
34 | |
30 |
User | Count |
---|---|
49 | |
37 | |
35 | |
29 | |
24 |