Search code examples
c#microsoft-graph-apisharepoint-onlinemicrosoft-graph-sdksmicrosoft-graph-teams

MS Graph: How To Distinguish Teams-Enabled M365 Groups Using GraphClient?


The MS Graph rest API surfaces a resourceProvisioningOptions attribute to indicate whether a MS365 group is also a Team (see below). However, those values do not appear to be available in the GraphServiceClient.

I found this post, and used the sites endpoint to get the associated SharePoint URL for an M365 group. But some M365 groups have SharePoint sites and are not Teams.

The only other option I found was to use the teams endpoint and catch the exception when no team is found for the group ID. But then I still have to do the additional sites endpoint query to get the SharePoint URL.

Does anyone know of another/better way to distinguish between Team/non-Team M365 groups when using the GraphServiceClient?

enter image description here


Solution

  • @Tracy,

    I have a test the SDK in a console app, I believe this property is under the group entity:

    enter image description here

    or you can add select option to omit the returned properties:

    graphClient.Groups.Request().Select("id,resourceProvisioningOptions").GetAsync().Result;
    

    BR