Add/Update Office 365 Group owners/members using Async Microsoft Graph Client CSOM

Posted by

In a recent project, we needed to updated members of an existing Office 365 group using Microsoft Graph Client CSOM. Previously in a blog here, I have listed a way to add members using Office 365 PnP CSOM (UnifiedGroupUtility) but there is an ongoing issue with it in the recent releases . So in the meantime while that issue is fixed, we could use the below method to update owners or members in O365 groups.

Steps:

  1. Create a Graph app. The steps for doing that is listed in this blog.
  2. Get the Authentication token of the App
  3. Get the list of owner emails and add them to a list array
  4. Call the Graph Client to authenticate using the authentication token
  5. Traverse the owners emails array and validate the user using the Graph users collection
  6. Add the user to the members and owners of the Office 365 group

Note: For Office 365 group owners, the users should be a part of the members and the owners groups.

Below is the code snippet for the same.

Happy Coding !!!

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s