Sharepoint Online Management Shell - group by more than 2 items in a list

%3CLINGO-SUB%20id%3D%22lingo-sub-841519%22%20slang%3D%22en-US%22%3ESharepoint%20Online%20Management%20Shell%20-%20group%20by%20more%20than%202%20items%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-841519%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20folks%20-%20I%20had%20this%20posted%20in%20the%20SharePoint%20community%2C%20but%20didn't%20get%20much%20response%20so%20I'm%20re-posting%20here%20in%20the%20PowerShell%20community%20to%20see%20if%20anyone%20here%20knows%20how%20to%20do%20this%20with%20PowerShell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe're%20using%20SharePoint%20online%20365%20modern.%20In%20a%20list%20view%20there%20we're%20only%20able%20to%20group%20by%202%20levels%20of%20columns.%20We%20want%20to%20be%20able%20to%20group%20by%20more%20than%202%20columns.%20I%20understand%20that%20out-of-the-box%20SharePoint%20does%20not%20have%20a%20way%20to%20group%20by%20more%20than%202%2C%20but%20I'm%20hoping%20there's%20a%20way%20we%20can%20use%20PowerShell%20to%20give%20us%20more%20than%202%20levels%20of%20grouping...%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20know%20if%20this%20is%20possible%20using%20PowerShell%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-841519%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-842659%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20Online%20Management%20Shell%20-%20group%20by%20more%20than%202%20items%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-842659%22%20slang%3D%22en-US%22%3E%3CP%3ENo.%20PowerShell%20in%20SPO%20is%20used%20for%20some%20administrative%20tasks%20on%20sites%2Fsite%20collections%2C%20it%20doesn't%20have%20any%20functionality%20that%20acts%20on%20the%20item%2Flist%20level.%20You%20should%20look%20into%20using%20the%20PnP%20PowerShell%20module%20or%20CSOM%20directly.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-846168%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20Online%20Management%20Shell%20-%20group%20by%20more%20than%202%20items%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-846168%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F272245%22%20target%3D%22_blank%22%3E%40Kateraid%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESeems%20not%20really%20supported...%20I've%20tried%20it%20on%20a%20Dev%20Tenant%20and%20after%20having%20applied%20the%20PnP%20template%20with%203%20Groups%20in%20my%20view%2C%20I%20get%20an%20error%20when%20I%20tried%20to%20refresh%20the%20view%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F130859iA05B4DFBB7D44315%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETried%20with%20this%20in%20the%20PnP%20template%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%20%20%3CQUERY%3E%0A%20%3CGROUPBY%20collapse%3D%22TRUE%22%20grouplimit%3D%2230%22%3E%0A%20%20%20%3CFIELDREF%20name%3D%22Category%22%3E%3C%2FFIELDREF%3E%0A%20%20%20%3CFIELDREF%20name%3D%22Location%22%3E%3C%2FFIELDREF%3E%0A%20%20%20%3CFIELDREF%20name%3D%22Language%22%3E%3C%2FFIELDREF%3E%0A%20%3C%2FGROUPBY%3E%0A%20%3CORDERBY%3E%0A%20%20%20%3CFIELDREF%20name%3D%22ID%22%3E%3C%2FFIELDREF%3E%0A%20%3C%2FORDERBY%3E%0A%20%20%3C%2FQUERY%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Hi folks - I had this posted in the SharePoint community, but didn't get much response so I'm re-posting here in the PowerShell community to see if anyone here knows how to do this with PowerShell.

 

We're using SharePoint online 365 modern. In a list view there we're only able to group by 2 levels of columns. We want to be able to group by more than 2 columns. I understand that out-of-the-box SharePoint does not have a way to group by more than 2, but I'm hoping there's a way we can use PowerShell to give us more than 2 levels of grouping... 

 

Does anyone know if this is possible using PowerShell? 

 

 

2 Replies
Highlighted

No. PowerShell in SPO is used for some administrative tasks on sites/site collections, it doesn't have any functionality that acts on the item/list level. You should look into using the PnP PowerShell module or CSOM directly.

Hi @Kateraid 

 

Seems not really supported... I've tried it on a Dev Tenant and after having applied the PnP template with 3 Groups in my view, I get an error when I tried to refresh the view:

clipboard_image_0.png

 

Tried with this in the PnP template

  <Query>
	<GroupBy Collapse="TRUE" GroupLimit="30">
	  <FieldRef Name="Category" />
	  <FieldRef Name="Location" />
	  <FieldRef Name="Language" />
	</GroupBy>
	<OrderBy>
	  <FieldRef Name="ID" />
	</OrderBy>
  </Query>