Programmatically create and Add Owners and Members to O365 Group, no emails are sent

Contributor

I'm using the code found in OfficeDevPnP.Core to create a new UnifiedGroup. UnifiedGroupsUtitlity.CreateUnifiedGroup. My code is below.

UnifiedGroupsUtility.CreateUnifiedGroup("CSOM Site Creation",
                              "My Site Created in Code,
                                                            CSOM,
                                                            accessToken,
                                                            groupLogo: null,
                                                            owners: owners.ToArray(),
                                                            members: members.ToArray(),
                                                            isPrivate: true,
                                                            createTeam: false);

When I'm using this code, none of the Owners or members get's an email saying they have joined the group, like they do if I add them manually to a group.

Do I have to write that part of the code to send the emails, or is there another method I can use that's already out there to send the same template that Microsoft sends?

There are two emails sent (if MS Teams included), when adding a person manually. One to say the person is added to the group from: The site on behalf of me. One to say the person is added to the MS Teams. From: noreply@email.teams.microsoft.com

It these emails I wish to replicate when adding a user to Group/Team.

0 Replies