In last article we discussed about fetching all Office 365 groups, in this article we will go one step ahead – we will discuss about fetching the respective group owners. We will discuss about one simple use case.

Use Case: For our Office 365 tenant, we have some governance
policies in place. One of our policy is to make sure for every modern team site
in tenant we have at least minimum two site collection administrators. If there
are less than two admins then need to send email to one of the admin. If there
is no admin at all to the site then email need to send to Global Administrator
of the tenant.

Approach: We planned to write again job (either
through Azure Web Job or Console Application), which will go through all the
Office 365 groups and check the Group Owners count. In this article we will
discuss by creating console application using Visual Studio 2017 and get the
Office 365 group owners using CSOM.

Important Point: Here, please note that we are
not going through the Modern Team Sites and verifying the Site Collection
Administrators. We will go through the Office 365 group which created behind
the scene when Modern Team site is get created.

Let’s begin the show 😊.

In last article we have detailed steps. In this article we will directly go through the require code base.

Once we have count of group owners, we can check whether there are two groups owners available or not and if not then we can send email to respective primary group owner or global administrator of the tenant.

Thanks for reading 😊

Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome.

Stay tuned on Knowledge-Junction, will come up with more such articles