Email a SharePoint Group from Flow?

Silver Contributor

Is there a way to email a SharePoint Group from a Flow? (not an O365 Group, not an AD group, but a legit SharePoint group)

 

Or do I have to define and maintain an actual Distribution Group for flow to send to?

26 Replies
Can anyone comment on this?

I'm also looking for this... this is a major step back for one of our projects.

Your group should have an email assigned to it like GROUPNAME@groups.yourorg.com to which you can send any normal email through your outlook connector

I can suggest a work around, have a sharepoint group assigned to a people/group field and have that field configured in the flow so it can send emails to all the users.
Has this been solved yet? Hoping it will be solved without a workaround, in other words an easy to use action that allows you to email a SharePoint Group. This is a very popular action in workflows.

This will not work. Tested but no success

There is a new Action for SharePoint, "Send an HTTP request to SharePoint", you can use this to retrieve the membership for a group using REST (find the Id of the group first or you can also use the same action to retrieve the groups for the site, then look through them to find your group):

_api/Web/SiteGroups/GetById(4)/users?$select=Title,Email

once you have that you can use the Outlook send mail action to send an email.

Hi,

 

Can i know how to use Active Directory Security group or Distribution group on Microsoft flow Approval Process. 

Please let me know if there is any direct step or any work around to fix this requirement.

 

 

Is there a way to do this? I am running into this now and need to email to all users in a SharePoint Group. 

@Terry Hagan If I use this, where does it store the information for me to be able use it later? 

Here is what I do for this (I am using this pattern for sending emails and assigning Flow tasks):

 

1) Initialize a variable of type string called "SendEmailTo"

2) Use the SharePoint HTTP call (i try to do everything using the Group ID)

flow_getGroupMembers.png

3) Use the Parse Json action against the body of the SharePoint Http using the schema in the attached file

flow_parseJSONGroupMembers.png

4) Do an Apply to Each on the body of the Parse Json action, and append the email (IMPORTANT with a semi colon) to your variable.  This is will built you a string of email addresses that can be used in the send email action.

flow_appendToVarGroupMembers.png

 

SCHEMA FOR PARSE JSON ACTION

{
"type": "object",
"properties": {
"d": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"__metadata": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"uri": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"Alerts": {
"type": "object",
"properties": {
"__deferred": {
"type": "object",
"properties": {
"uri": {
"type": "string"
}
}
}
}
},
"Groups": {
"type": "object",
"properties": {
"__deferred": {
"type": "object",
"properties": {
"uri": {
"type": "string"
}
}
}
}
},
"Id": {
"type": "number"
},
"IsHiddenInUI": {
"type": "boolean"
},
"LoginName": {
"type": "string"
},
"Title": {
"type": "string"
},
"PrincipalType": {
"type": "number"
},
"Email": {
"type": "string"
},
"IsEmailAuthenticationGuestUser": {
"type": "boolean"
},
"IsShareByEmailGuestUser": {
"type": "boolean"
},
"IsSiteAdmin": {
"type": "boolean"
},
"UserId": {
"type": "object",
"properties": {
"__metadata": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"NameId": {
"type": "string"
},
"NameIdIssuer": {
"type": "string"
}
}
}
},
"required": [
"__metadata",
"Alerts",
"Groups",
"Id",
"IsHiddenInUI",
"LoginName",
"Title",
"PrincipalType",
"Email",
"IsEmailAuthenticationGuestUser",
"IsShareByEmailGuestUser",
"IsSiteAdmin",
"UserId"
]
}
}
}
}
}
}

 

It doesn't store anything, the information, user title and email, is already stored in the SharePoint Group for you to use when you retrieve it.

I figured out how to do this some time ago. Since there's still interest in this I wrote up a blog post showing how to do it: https://techcommunity.microsoft.com/t5/PowerApps-Flow/Email-a-SharePoint-Group-from-Flow/m-p/266744#...

The link to the blog is broken - it takes me back to the post. Anyone managed to solve this? SharePoint Designer Workflow were so much easier.

Thanks a lot !

I also didn't get this to run with the provided JSON. 

I had a successful run after I changed it to this:

{
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"d": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"results": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"__metadata": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"id": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"uri": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"type": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
}
}
}
}
},
"Alerts": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"__deferred": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"uri": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
},
"Groups": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"__deferred": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"uri": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
},
"Id": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"IsHiddenInUI": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"LoginName": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"Title": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"PrincipalType": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"Email": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"IsEmailAuthenticationGuestUser": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"IsShareByEmailGuestUser": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"IsSiteAdmin": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"UserId": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"__metadata": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"properties": {
"type": "object",
"properties": {
"type": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
}
}
}
}
},
"NameId": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
},
"NameIdIssuer": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
}
}
}
}
}
}
}
},
"required": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
}
}

Microsoft, if you expect people to be moving away from Workflows to Flow, they're going to need BASIC functionality like this, not some hacky REST API calls done out of desperation.

I wouldn't suggest that using a REST call is a "hacky" technique out of desperation, although I understand your frustration if you are a power user. Most things for a web developer or software engineer are done via REST calls to a database, so this technique is very familiar. Brent's answer works perfectly fine for me and was well documented. The only thing he forgot to include was adding the variable, but once again, this is a familiar thing for a web dev.

 

Modifications from Brent's answer:

 

I removed "Title" from the filter to just return only emails since that's all that's required.

/_api/Web/SiteGroups/GetById(29)/users?$select=Email

Here's what I used for my schema, if you use this as sample payload it'll just convert the values such as "some text" to it's data type "String".

{
"d": {
"results": [
{
"__metadata": {
"id": "Some text",
"uri": "Some text",
"type": "SP.User"
},
"Email": "Some text"
},
{
"__metadata": {
"id": "Some text",
"uri": "Some text",
"type": "SP.User"
},
"Email": "Some text"
},
{
"__metadata": {
"id": "Some text",
"uri": "Some text",
"type": "SP.User"
},
"Email": "Some text"
}
]
}
}