I'm trying to query the Microsoft Graph API to interact with plans within a group.
I'm using this method in the SDK:
graphClient.Groups[id.ToString()].Planner.Plans.GetAsync();
However, this incurs the following exception:
Microsoft.Graph.Models.ODataErrors.ODataError: You do not have the required permissions to access this item.
I've used the same GraphClient to list the groups, and to retrieve the group whose ID is used in the above method call, which has the following permissions assigned:
Group.Read.All(Application and Delegated)Group.ReadWrite.All(Application and Delegated)GroupMember.Read.All(Application)Tasks.Read(Delegated)Tasks.Read.Shared(Delegated)Tasks.ReadWrite(Delegated)Tasks.ReadWrite.Shared(Delegated)User.Read(Delegated)
To obtain a GraphClient I used the code found in the sample [here][1]. The only part I changed is to use my own tenantId, clientId, and clientSecret.
What extra permission is needed to list the plans within a group?
The error occurred as you missed granting
Tasks.Read.Allpermission that is required to list plans within group while using client credentials flow.I registered one Entra ID application granted same API permissions as you:
When I tried to list plans within the group, I got same error like this:
To resolve the error, make sure to grant
Tasks.Read.Allpermission of Application type by granting admin consent to it as below:When I ran below code after granting required permission, I got the response with list of plans successfully:
Response:
Reference: List plans - Microsoft Graph v1.0