Power Platform : Power Automate – sending email to SharePoint group (all users / members of the SharePoint group)

Power Automate - For sending emails to users / members of SharePoint group
Power Automate - For sending emails to users / members of SharePoint group

Background / Use Case:

  • In one of our project we need to send an email to SharePoint group when new item is created in SharePoint list using Power Automate
  • Since its SharePoint group we do not have email address associated it we tried to find workaround for the same
  • So workaround is to send an email to users in a group – group members

High level Steps

Detailed Steps

  • We have created SharePoint group – Knowledge Junction
  • We need to send the email to member of our SharePoint group – Knowledge Junction
M365 - SharePoint Online - SharePoint group
fig : M365 – SharePoint Online – SharePoint group
  • We have also created one SharePoint list – “Demo Email To SP Group”
  • For demo purpose we have only kept one field – Title
  • On creation of new item in this list – our Power Automate will trigger and will send an email to members of group which we created – Knowledge Junction
M365 - SharePoint Online - SharePoint List
fig : M365 – SharePoint Online – SharePoint List
  • Now lets move to Power Automate
  • From “App Launcher” bar navigate to “Power Automate” as shown in below fig
Power Platform - Power Automate - navigating to Power Automate
fig : Power Platform – Power Automate – navigating to Power Automate
  • We will be redirecting to Power Automate
  • From left pane click on “+ Create” and select “Automated cloud flow” as shown in below fig
Power Platform - Power Automate - Creating Automated cloud flow
fig : Power Platform – Power Automate – Creating Automated cloud flow
  • Specify the flow name
  • Select the trigger – “When an item is created“
Power Platform - Power Automate - Creating Automated cloud flow - on trigger - "When an item is created"
fig : Power Platform – Power Automate – Creating Automated cloud flow – on trigger – “When an item is created”
  • Specify the “Site Address” and “List Name” as
Power Platform - Power Automate - Creating Automated cloud flow - on trigger - "When an item is created" - specifying "Site Name" and "List Name"
fig : Power Platform – Power Automate – Creating Automated cloud flow – on trigger – “When an item is created” – specifying “Site Address” and “List Name”
  • Next step is to get the users from group / group members
  • We will use REST API – _api/web/sitegroups(6882)/users?$select=Email
Power Automate - action "Send an HTTP request to SharePoint" to call REST API for getting all users of given group - _api/web/sitegroups(6882)/users?$select=Email
fig : Power Automate – action “Send an HTTP request to SharePoint” to call REST API for getting all users of given group – _api/web/sitegroups(6882)/users?$select=Email
  • As above REST API request is executed we will have response in JSON format as
Power Automate - response of  REST API call in JSON format
fig : Power Automate – response of REST API call in JSON format
  • As we have result is in place in JSON format as shown in above fig
  • We will use “Select” action to parse the JSON result and get the email addresses of users
  • Add the “Select” action in our Power Automate
  • In select action, in From – put the following expression

@{body('Send_an_HTTP_request_to_SharePoint')?['d']?['results']}

  • And in Map field specify following expression since we need to fetch Emails of users

item()?['Email']
Power Automate - action - "Select" to get the Email of users from the response of REST API
fig : Power Automate – action – “Select” to get the Email of users from the response of REST API
  • As we have all emails in output of “Select” action
  • Next to join the emails using “;” to use in Outlook – we will use “Compose” field and use following expressions
  • Following expression will join all the emails and separate them by “;”

join(body('Select'),';')

Power Automate - action - "Compose" to print the result
fig : Power Automate – action – “Compose” to join all the emails and separated by “;”
  • Once we have “Emails” separated by “;” we will use Office 365 Outlook – “Send an email (v2)” action for sending the email as shown in below fig
  • We will use “Output” of compose action
Power Automate - sending email using Office 365 Outlook
fig : Power Automate – sending email using Office 365 Outlook

Complete Flow

Power Automate - For sending emails to users of SharePoint group
fig : Power Automate – For sending emails to users / members of SharePoint group

Thanks for reading the article !!! Please feel free to discuss in case any issues / suggestions / thoughts / questions

HAVE A GREAT TIME AHEAD !!!

Prasham Sabadra

LIFE IS VERY BEAUTIFUL. ENJOY THE WHOLE JOURNEY :) Founder of Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.