SharePoint 2013 Group by content type

Just like SharePoint 2010 it is not possible with SharePoint 2013 to create a view with a ‘group by’ or ‘sort’ for the content type column with the help of the the user interface. Fortunately we can create the ‘group by’ content type view with the help of SharePoint Designer and a bit of code. Sorting the view on content type is not possible with this solution. When using this solution be aware of the following downside. When the view is modified through code, you should no longer edit the view through the user interface. When you edit the view through the user interface the code will be removed automatically.

Solution
1. Create through the user interface the view you need.
2. Set the Group By on the column Created.
3. Save the view.
4. Open the view with SharePoint designer in the advanced mode.
5. Find the following code.

<GroupBy Collapse="TRUE" GroupLimit="30"><FieldRef Name="Created"/></GroupBy>

6. Change Created into ContentType
8. Save the changes.

Result
???????????

Inhoudstype is dutch for Contenttype. 

Share

10 Replies to “SharePoint 2013 Group by content type”

  1. Great website! I am loving it!! Will be back later to read some more. I am taking your feeds also eabebakefefe

  2. Fact that if you modify again the View is killing the change made from Sharepoint Designer is a NO GO for me.
    However there is another way to do it. Create a Site Column at the ContentType level, name it “Content Type Label” for instance, choose a Choice column. Set the the Content Type Name in the choice list and default value.
    And edit again the Content Type column created and choose to set this column as hidden (so user can’t modify it at creation of new items within this content type). And then you can create your grouping using that “Content Type Label” column without fearing that anyone attempting to modify the view will remove the Sharepoint Designer trick.

    1. Not that doesn’t work. I can’t set a different default value for each of the inherited Content Types….

  3. Ben, thank you very much for posting your great solution ! It works for my SP 2013 list with many custom content types !

Leave a Reply to Jason Heiser (@breaker119) Cancel reply

Your email address will not be published. Required fields are marked *