How to Group By Content Type in SharePoint 2010
For some reason in SharePoint 2010 you can’t actually create views that group by Content Type through the user interface. You will see below that the Content Type option is not available:
God only knows why you can’t, but you can’t so there is no need to complain especially since SharePoint Designer can easily do it for you. So to do this what I do is create a grouping on something, it doesn’t matter because we are going to change it anyway but you do need some XLST to change so simply select Created for example.
Now go back to the page and fire up SharePoint Designer, you can now do this from the Site Actions menu to make it easier. Navigate to your Document Library and click on the ‘All Documents‘ link underneath views, set your view mode to ‘Split’ and click on the actual list view.
Click on the Grouping icon on the user interface and you should see the XML that is doing the grouping:
<pre><Query> <GroupBy Collapse="TRUE" GroupLimit="30"> <FieldRef="Created"/> </GroupBy> </Query>
Now simply change the ‘Created‘ to ‘ContentType‘, press save and you now have your view group by Content Type!
Keep in mind that this also works for any other field as well and with the new SharePoint 2010 List View you can always play around with the view in the UI as well!
Category: How To







Great tip!
[...] this post for further [...]
Thanks for this post. I was able to use this method to group by content type for a list that’s displayed via a web part on a web part page. However, I tried the same methodology on a different view of the same list and it’s not working. In the group by area it shows “Content Type ID: ” (with no value), instead of “Content Type: Design Submission”. Any idea if I need to do something different?
Hi Monica,
Interesting. What type of view are you creating? Is it a standard list view or calendar view or something else?
In both places it’s a standard list view that groups by 2 columns. It’s pretty much the same view in both places (+/- a few columns that are displayed in one area). There’s no filtering.
I was able to get the sorting to work on the view where the grouping wasn’t working using this same method, and that’s an acceptable alternative.
Thanks, really helpfull tip!
Thanks! Now I finally can group on Content Types.
For me, the groups are not listed in alphabetical order when I´m grouping on content types. Grouping on other properties works fine. Someone with the same problem out there?
Does not Work. If you edit .aspx of your View with SharePoint Designer and user opens and save list configuration @ user gui then definition will be overridden by default and get corrupt.
to solve the problem, i think we have to change the standard view default definitions to get the field contenttyp to the dropdown
[...] Att vara Early adopter har ibland sina baksidor. Sharepoint 2010 är inget undantag. Upptäckte nyligen att innehålstyper saknades som val när jag skulle gruppera i en vy. Jag hade lagt till en webbdel på första sidan för att visa innehållet i en lista. Jag hade som vanligt valt att redigera min webbdel och sedan ”Redigera aktuell vy”. Här kunde jag gruppera på allt möjligt, men innehålstyperna hade rymt likt en Werneriansk julskinka. Hittade tack och lov denna trevlig blogg: http://www.sharepointanalysthq.com/2010/06/how-to-group-by-content-type-in-sharepoint-2010/ [...]
[...] http://www.sharepointanalysthq.com/2010/06/how-to-group-by-content-type-in-sharepoint-2010/ [...]
Awesome post, thanks so much, so easy but I wouldn’t have thought of that!!
Hi there – great post ! One question, when i modily this view form within the library, the group by content type disappears – even if i do not expand the Group By option but only add a new sorting arrangement.
Any ideas please?
Can this then be saved as a template and reused for new libs?
Thanks again
Ian
I tried to do this for the “Assigned To” column, and the view will look correct and convert to group by a person and show a number of items, but when you expand the grouping from the plus symbol it shows all the items in the list again and not the number of items shown next to the persons name. Is this a unique column for this solution?
Hi. This works; however, I’m having an odd problem (no matter what field I choose to group by) where the view will only show one group per page even when collapsed. The setting for number of groups to show per page has no effect. This is a standard library All Documents view. The site was upgraded from MOSS 2007 some time ago. I created a brand new view that uses grouping and the problem is the same.
In reply to Monica…when adding the web part progrmatically just use XsltListViewWebPart instead of ListViewWebPart.
Why in the world did Microsoft even get rid of this option?? I used it all the time in 2007. Seems very foolish to me. Now every view that has this workaround is edited in the web it wipes out the group by content type. Very frustrating…
Thanks for sharing but…
I am creating the view and putting it on a web part in PowerShell and I am getting the same problem as Monica, i.e.
Content Type ID: with no value in place of
Content Type: {ct name}
If I place a new document library web part through the SharePoint interface my view is not in the list of available views.
If I go to the document library’s page the view is available and it works properly with the content type grouped by name.
If I find out why this is happenenig I will post again, hope this helps someone.
[...] but it requires editing the page in the SharePoint 2010 Designer. Michal Pisarek in his post How to Group By Content Type in SharePoint 2010 explains is pretty [...]