Get SharePoint group members using Power Automate

Loading

How to get groups of SharePoint through Power automate and send an email to the particular group

Create a SharePoint group in the SharePoint list settings

I have created a group named ‘MembersGroup’ and added two persons to the group

To get the groups, create a Power Automate flow – I have created with an action [when an item is created] and the task is to send an email to the persons in the MembersGroup, So after initial action I used send an email (V2)

get group using an action called ‘Send an HTTP request’ , provide the site link , Using the Get method and the Uri to be used to get the groups is

_api/web/sitegroups(19)/users

(19) – it defines the ID of the group from the SharePoint MembersGroup /users -we are fetching from the SharePoint

next step to take an action select to get the users from the array of the outputs ‘send an HTTP request’

so we get the body from the action ‘send an HTTP request’

but we require the array results from the body , so we create an expression in form of select action Outputs of body & array, thus we get the array of the body

outputs('Sharepoint_get_Group_Members')?['body']?['d']?['results']

to get the required Emails from the group array , we use item expression to Map filed

item()?['Email']

thus we get the users emails into the action using the above expression ( In further any user may be added to the ‘MemberGroup’ shall be automatically fetches into the Power automate without any implements)

Now we get the Emails in the above action select, but we need to separate the emails with semicolon ‘ ; ‘ as which the emails could not able to send in the power automate if it not separated by the semicolon ‘ ; ‘

So we take the action compose and use an expression join

join(body('Select_get_emails'),';')

as we take join expression, it asks for the collection and a array

the collection would be the outputs of the select action and the array would be the semicolon ‘ ; ‘

and thus we get the emails of the users in the MemberGroups and also separated by the semicolon’;’

The final Output is the email sent to the Group of people/users which exists in the ‘MemberGroup’, So Initially I have added ManuL & LTuck to the group, by default testdigital would exist as the creator of the group .

Leave a Reply

Your email address will not be published. Required fields are marked *