With actions configuration below you can get user email addresses from the SharePoint group and send to all members. You can use this configuration in Modern Forms, List Actions and Background actions (Scheduled and Triggered Actions). You can download Send email to SharePoint group members file and import to your action.
Configuration steps:
Manage Variables
Create two variables: GroupName and GroupUserEmails. In GroupName variable enter specific group you want to get users from.
Send HTTP request
Add Send HTTP request action
Configure Send HTTP request action with configuration:
URL
=[[@Web.Url]] + "/_api/web/sitegroups/getbyname('" + [[@Variables.GroupName]] + "')/users"
Request type
GET
Headers
Accept: application/json; odata=nometadata
Content-Type: application/json; odata=nometadata
[[@Variables.GroupName]] is a variable output with SharePoint group.
Set variable
Configure Set variable action
Select GroupUserEmails variable with value:
var emails = "";
var response = [[@Actions.Send_HTTP_request_to_get_users_from_group.ResponseBody]];
var users = response.value;
users.forEach(function (user) {
if (user && user.Email) {
emails += user.Email + ";";
}
});
return emails;
[[@Actions.Send_HTTP_request_to_get_users_from_group.ResponseBody]] is an output from Send HTTP request action with user emails.
Send email
Add Send email action.
In To field enter [[@Variables.GroupUserEmails]] variable output with user emails.