You can extract SharePoint groups and their members using Power Automate by following these steps:
-
Start with a new flow: Create a new Power Automate flow from the Power Automate dashboard.
-
Add a SharePoint connector: In the new flow, add a "Get items" action from the SharePoint connector. Choose the SharePoint site and list/library that contains the group you want to extract.
-
Filter SharePoint groups: Add a filter query to retrieve only the groups from the SharePoint list. The filter query should be set to return only items with the "Content Type" set to "Group".
-
Initialize variables: Initialize a variable to store the group names and another variable to store the members of each group.
-
Add a loop: Add a "Apply to each" loop and set the input to the "value" property of the "Get items" action.
-
Get group details: Within the loop, add a "Get group" action from the SharePoint connector. Set the "Group ID" to the "ID" property of the loop value.
-
Add a nested loop: Add another "Apply to each" loop within the first loop, and set the input to the "value" property of the "Get group" action. This will loop through each member of the group.
-
Get user details: Within the nested loop, add a "Get user profile" action from the Office 365 Users connector. Set the "User (UPN)" property to the "Email" property of the loop value.
-
Append data to variables: Within the nested loop, append the group name to the variable storing group names and append the user details to the variable storing group members.
-
Send the output: Finally, add an "Email" action to the end of the flow to send the output to a specified email address. In the body of the email, include the variables storing the group names and group members.
This flow will extract all the groups and their members from a SharePoint site and send the output via email. You can modify the flow to store the output in SharePoint or another location, depending on your needs.