Search code examples
c#microsoft-graph-apimicrosoft-teamsmicrosoft-graph-sdksmicrosoft-graph-teams

Microsoft.Graph.Group missing resourceProvisioningOptions atrribute


I'm trying to identify Teams by displayname using the .NET SDK. I'm not using the beta API on purpose as I'm creating a production application. In order to identify a group that is a Team i'm wanting to use the resourceProvisioningOptions as that contains a value of "Team".

In postman I can do this simply via

https://graph.microsoft.com/v1.0/groups?$filter=startswith(displayName,'My Team') 

In the returned attributes I see

"resourceProvisioningOptions": [
   "Team"
]

The C# I'm using to do the same thing is

var request = await graphClient.Groups
    .Request()
    .Header("ConsistencyLevel", "eventual")
    .Filter("startswith(displayName,'My Team')")
    .Select("id,displayName,description,resourceProvisoiningOptions")
    .GetAsync();

Then (for testing sake)

foreach (var item in request) {
    Console.WriteLine(item.id);
    Console.WriteLine(item.resourceProvisioningOptions);
}

However the Microsoft.Graph.Group Type doesn't appear to have the resourceProvisioningOptions property. So i'm wondering how I could correctly identify Team Groups.

I know with the Beta API i can filter our non Team Groups using resouceProvisioningOptions/Any(etc) but as I mentioned I'm not going to use that.

This is my first post and thanks in advance of any help!


Solution

  • Yes, as you said even I am also unable to see resourceProvisioningOptions when I try to query list of Group. After some research I found, there are some properties that can be found in the AdditionalData property while debugging and you can see the resourceProvisioningOptions in that property.

    You can enumerate that data using the below code.

    IGraphServiceGroupsCollectionPage m = await GraphHelper.getGroups();
    foreach (var data in m)
    {
            Console.WriteLine(data.AdditionalData["resourceProvisioningOptions"] + " " + data.displayName);
    }
    

    Each Group has AdditionalData and use it to get your missing properties.