Querying Office 365 Plans using PowerShell

%3CLINGO-SUB%20id%3D%22lingo-sub-708840%22%20slang%3D%22en-US%22%3EQuerying%20Office%20365%20Plans%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-708840%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20been%20trying%20to%20get%20a%20list%20of%20all%20my%20plans%20within%20an%20Office%20365%20group.%26nbsp%3B%20I've%20tried%20using%20various%20methods%20of%20authentication%20using%20client%20ID%20and%20secret%20with%20the%20proper%20group%20permissions%2C%20login%20credentials%20and%20others.%26nbsp%3B%20No%20matter%20what%20I%20try%2C%20I'm%20getting%20401%20or%20403%20errors.%26nbsp%3B%20Does%20anyone%20have%20a%20sample%20that%20shows%20how%20they%20authenticate%20to%20Office%20365%2C%20get%20a%20list%20of%20Office%20365%20Groups%20and%20the%20Plans%20for%20each%20Group%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20in%20advance%2C%3C%2FP%3E%0A%3CP%3E-Haniel%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-709625%22%20slang%3D%22en-US%22%3ERe%3A%20Querying%20Office%20365%20Plans%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-709625%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4865%22%20target%3D%22_blank%22%3E%40Haniel%20Croitoru%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20work%20with%20groups%20and%20plans%2C%20you%20should%20have%20acquired%20your%20access%20token%20with%20the%20permission%26nbsp%3B%3CSPAN%3E%26nbsp%3B%22Group.ReadWrite.All%22%20(or%20Group.Read.All).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAnd%20most%20importantly%2C%20you%20should%20be%20a%20member%20of%20the%20group%20to%20list%20plans%20of%20the%20group.%20You%20will%20get%20403%20(Forbidden)%20error%2C%20if%20you%20try%20to%20get%20plans%26nbsp%3Band%20its%20data%20without%20being%20a%20member%20of%20the%20plan's%20associated%20group%20even%20if%20you%20have%20global%20admin%20privilege%20and%20the%20token%20with%26nbsp%3BGroup.ReadWrite.All%20permission.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESo%20please%20ensure%20that%20the%20user%20has%20been%20added%20as%20member%20of%20the%20group%20and%20the%20acquired%20token%20has%26nbsp%3B%26nbsp%3B%22Group.ReadWrite.All%22%20(or%20Group.Read.All)%20permission.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ERelated%20thread%20%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FPlanner%2FWildcards-in-Graph-to-see-all-planners%2Fm-p%2F677437%23M2602%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FPlanner%2FWildcards-in-Graph-to-see-all-planners%2Fm-p%2F677437%23M2602%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
MVP

Hi,

 

I've been trying to get a list of all my plans within an Office 365 group.  I've tried using various methods of authentication using client ID and secret with the proper group permissions, login credentials and others.  No matter what I try, I'm getting 401 or 403 errors.  Does anyone have a sample that shows how they authenticate to Office 365, get a list of Office 365 Groups and the Plans for each Group?

 

Thanks in advance,

-Haniel

 

 

1 Reply
Highlighted

@Haniel Croitoru 

 

To work with groups and plans, you should have acquired your access token with the permission  "Group.ReadWrite.All" (or Group.Read.All).

 

And most importantly, you should be a member of the group to list plans of the group. You will get 403 (Forbidden) error, if you try to get plans and its data without being a member of the plan's associated group even if you have global admin privilege and the token with Group.ReadWrite.All permission.

 

So please ensure that the user has been added as member of the group and the acquired token has  "Group.ReadWrite.All" (or Group.Read.All) permission.

 

Related thread : https://techcommunity.microsoft.com/t5/Planner/Wildcards-in-Graph-to-see-all-planners/m-p/677437#M26...