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

Brass 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

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>