SharePoint Power Searching Using ContentClass

Editor’s note: The following post was written by SharePoint Server MVPMike Smith

SharePoint Power Searching Using ContentClass

 

"Power Searching" might be a bit of a stretch, but 99% of end users doing SharePoint searches don't know about this search option. Most searches performed by SharePoint users tend to look like general web searches; they enter a keyword or two, click the search button and get back 12,000 results. They then look at the first page or two of the results, and then give up. “Power searchers” can take advantage of search Managed Properties to refine their search on hundreds of properties like FileSize, LastModifiedTime and Author. Many of these properties are intuitive to SharePoint users, but a few like ContentClass are not “guessable” and a complete list of values is not to be found.

 

Searching with Content Class

If you are searching for broad categories of SharePoint content like all tasks or all announcements you can use either a search for a Content Type or a search for a ContentClass.

 

The choice depends on if you are looking for all "announcements" or “all things in announcement lists". As lists can have more than one content type, you will likely find more items using ContentType. (I often add the Announcement content type to my Task lists.)

Content Types are easy to work with as there is a list of them right in SharePoint: Settings, Site Settings, Content Types. The only trick needed when using ContentType is to put quotes around the content type name when there are spaces in the name. ContentClass is not as easy as there is no list of the codes in SharePoint. There's not even a complete list in the SharePoint API, MSDN or TechNet.

 

Using ContentClass

Let's say you want to find the announcement list named "Sales News". You try a general “Everything” search for "Sales News", and get back thousands of items. You put quotes around that text to search for an exact phrase, and get back a few hundred items. You are finding blog articles, Word documents and all kinds of content when all you wanted is just the list itself.

Now for the power of ContentClass… Try this search "contentclass=STS_List_Announcements". Now you are just getting a list of only announcement lists. Close, but there are hundreds of these in your SharePoint sites. Now try "contentclass=STS_List_Announcements Sales News" or "Sales News contentclass=STS_List_Announcements". There's your announcements list!

 

Tips:

  • You can write your query using wildcards or the contains operator (“:”) to broaden your searches. “contentclass:STS_List_” produces the same result as “contentclass=STS_List_*” and both will return a list of all your lists and libraries. Using just “contentclass:STS_List” will return all lists and all list items. (No “_” after “List”.)
  • When used with contentclass, “:” means “starts with” rather than “contains”. I.e., “contentclass:List” will return nothing.
  • As a default, when not searching “People” SharePoint will append an exclude to your query. I.e. a search for “Sales Teams” generates this query:
    “Sales Teams -ContentClass=urn:content-class:SPSPeople”.

 

Just what is ContentClass?

  • It’s a code that represents a type of crawled content and is stored as a search Managed Property.
  • It’s a documented property for SharePoint 2001 and 2003. In most of MSDN and TechNet it is just listed as “a string containing the content class value”.  (It’s also the name of an unrelated property used in Exchange, SharePoint QuickLinks class and elsewhere.)
  • It’s a list of codes found here https://msdn.microsoft.com/en-gb/library/ms975759.aspx. But that is an article from 2003 or thereabouts. There are hundreds of blog articles that have a list with 30 some entries. So far I have not been able to find a current and complete official list of ContentClass codes.
  • It is a search criteria usable just about anywhere you perform searches: the search box the end user sees, the Query Transform and Query editor of the search web parts, the REST API for search and CAML searches.

 

Had to Build My Own List!

Where do they come from? Somewhere in the indexing proces obviously, but I can't find documentation on that either. I started by digging through SharePoint: the API, SQL tables, and the files in the install directories, but I could not find a single complete and authoritative source.

Most lists of constants can be found in the MSDN or TechNet documentation, or from an enumeration object in the SharePoint API. But not ContentClass. I ran the SQL Profiler looking for "STS_" during searches… nothing. I did text searches through many of the SharePoint SQL tables (never do this on a production farm!)… nothing useful. In the end: I wrote PowerShell scripts to find all of the feature files and to discover the type numbers in the list template XML, searched all of my sites for lists and their properties, searched the web, and just did a lot of trial and error searching.

 

Multiple Naming Conventions

While I could not find a single source of the codes in SharePoint, I did find some hints, starting with how they are named. The strings used as ContentClass codes follow several different patterns:

  • STS_LIST_listname
  • STS_LIST_listIDnumber (from Type="000" in the feature file for the list templates)
  • STS_LISTITEM_listname
  • STS_LISTITEM_listIDnumber (from Type="000" in the feature file for the list templates)
  • urn:content-class:typeOfContent
  • urn:content-classes:typeOfContent

URN?

The Universal Resource Names (URN) used in ContentClass may have roots in SharePoint 2001 or maybe Exchange 2000 or older technologies. They do seem to be static as I have not seen any updates to this list in the last few versions of SharePoint. The URN codes primarily define content not found in lists and libraries. Except for “urn:content-class:SPSPeople” I have not even found any examples of their use. While the URNs are listed below, this article is going to focus on the “STS” items.

News Listing                       urn:content-class:SPSListing:News

People                                  urn:content-class:SPSPeople

Search Query                     urn:content-class:SPSSearchQuery

Category                              urn:content-classes:SPSCategory

Listing                                   urn:content-classes:SPSListing

Person Listing                    urn:content-classes:SPSPersonListing

Site Listing                           urn:content-classes:SPSSiteListing

Site Registry Listing         urn:content-classes:SPSSiteRegistry

Text Listing                         urn:content-classes:SPSTextListing

URN related notes:

  • Only one of these is used by the out of the box Result Sources, urn:content-class:SPSPeople.
  • When you create a Result Source you must select a “Type” option. This option appends either “urn:content-class:SPSPeople” or “-urn:content-class:SPSPeople” to the query transform.   

                                      

STS_LIST

While reviewing the ContentClass values that start with “STS_LIST” I noticed a pattern… they all seem to match the names found in the Microsoft.SharePoint.SPListTemplateType enumeration. Just take the name found there and prefix it with “STS_LIST_” and you have many of the STS_LIST contentclass codes! The only problem is that the enumeration’s list is not complete. There are many missing list types including “Assets” and “Pages”. Be aware that there are list types included in the enumeration that are not indexed by search or are hidden from the user and won’t be found in search. As a test, I have changed the status of a few hidden lists to Hidden=false and re-crawled the content and found that the predicted ContentClass codes will work. Example: STS_List_Timecard.

What about “Assets”? There is a documented “STS_LIST” for Asset libraries, but it’s not “STS_LIST_ASSETS”, it’s “STS_LIST_851”. There’s the hint for all of the missing list types. To find all of the Pages libraries all you need is to know the list’s number “850” and that the ContentClass code is then “STS_LIST_850”. These numbers can be found in the SPListTemplateType enumeration and in the Feature elements files that create the list templates.

 

My List

With lots of coffee, trial and error and detective work I have come up with the list below of ContentClass codes. As this list is related to, and in many ways a subset of, a bigger list of lists, I have created a merged list of Registration IDs, Features IDs and ContentClass codes for lists on my blog site.

Notes:

  • For each item in this list there is a matching “Items” value. For example, there’s both an STS_List_Announcement and an STS_ListItem_Announcement.
  • I have not included hidden lists as they are not visible to users from search. These are in the larger list on by blog.
  • Not all lists are available in all sites. The available lists depend on the template and enabled features.
  • Not all of the lists can be created in SharePoint 2013, at least without using code or PowerShell. Many of these lists are “deprecated” and are only still supported for upgrades from older SharePoint versions.
  • All searches are security trimmed.
  • Be cautious with contains (“:”) and wild card searches. Using “contentclass:STS_List” will return all lists, but will also return all list items. In most cases you will want to use equals (“=”) with ContentClass. A handy exception is when searching for tasks. As there are two types of task lists you may want to search using “contentclass:STS_List_Task” or “contentclass=STS_List_Task*”
  • “STS” probably stands for SharePoint Team Services from 2001.

 

Non-list ContentClass codes

Common name

Enum Name

List ID

ContentClass

Site Collections (Search returns the home page of the top level sites.)                 

None

 

STS_Site

Note: This will include all MySites.

Webs

None

 

STS_Web

All lists

None

 

STS_List This is not real, but often found in ContentClass lists on the web. It is only used with a “contains” or a wild card search.  ContentClass:STS_List or ContentClass=STS_List* Note that this will return all lists and list items. A better search for all lists would be “STS_List_”.

All list items

None

 

STS_ListItem This is not real, but often found in ContentClass lists on the web. It is only used with a “contains” or a wild card search.  ContentClass:STS_ListItem or ContentClass=STS_ListItem*

People

None

 

urn:content-class:SPSPeople

Note: Most SharePoint searches modify your query and add “-urn:content-class:SPSPeople” to exclude user profile content.

All root level ASPX pages. I.e. not in a library.  Example: https://yourServer/sites/yoursite /somepage.aspx

Does not return all documents!

None

 

STS_Document

 

List ContentClass codes

Common name

Enum Name

List ID

ContentClass

Custom List                 

GenericList

100

STS_List

Document Library          

DocumentLibrary

101

STS_List_DocumentLibrary

Survey List                  

Survey

102

STS_List_Survey

Links List                     

Links

103

STS_List_Links

Announcements List 

Announcements

104

STS_List_Announcements

Contacts List                

Contacts

105

STS_List_Contacts

Events List                  

Events

106

STS_List_Events

Tasks List                    

Tasks

107

STS_List_Tasks

Discussion List              

DiscussionBoard

108

STS_List_DiscussionBoard

Picture Library              

PictureLibrary

109

STS_List_PictureLibrary

Form Library (typically InfoPath forms)     

XMLForm

115

STS_List_XMLForm

Web Page Library          

WebPageLibrary

119

STS_List_WebPageLibrary

Data Connection Library

DataConnectionLibrary

130

STS_List_DataConnectionLibrary

Preservation Hold Library

 

131

STS_List_131

Project Tasks List         

GanttTasks

150

STS_List_GanttTasks

Promoted Links

 

170

STS_List_170

Tasks (2013 version)

TasksWithTimelineAndHierarchy

171

STS_List_TasksWithTimelineAndHierarchy

Agenda

Agenda

201

STS_List_Agenda

Attendees

MeetingUser

202

STS_List_MeetingUser

Decisions

Decision

204

STS_List_Decision

Objectives

MeetingObjective

207

STS_List_MeetingObjective

Text Box / Directions

TextBox

210

STS_List_TextBox

Things To Bring

ThingsToBring

211

STS_List_ThingsToBring

Blog Posts/ Tabs List

Posts

301

STS_List_Posts

Blog Comments

Comments

302

STS_List_Comments

Blog Categories

Categories

303

STS_List_Categories

App Catalog

 

330

STS_List_330

Apps for Office

 

332

STS_List_332

App Requests

 

333

STS_List_333

USysApplicationLog - Access

 

398

STS_List_398

MSysASO - Access

 

399

STS_List_399

Resources - Group Work Site

Facility

402

STS_List_Facility

Whereabouts - Group Work Site

Whereabouts

403

STS_List_Whereabouts

Phone Call Memo  - Group Work Site

CallTrack

404

STS_List_CallTrack

Circulations - Group Work Site

Circulation

405

STS_List_Circulation

Timecard (hidden) - publishing

Timecard

420

STS_List_TimeCard

StatusIndicatorList / KPIs

 

432

STS_List_432

Report Library

 

433

STS_List_433

Dashboard content

 

450

STS_List_450

Data Sources - Perfomance Point

 

460

STS_List_460

Dashboards

 

480

STS_List_480

Categories - community site

 

500

STS_List_500

Visio Repository Site Process Diagrams

 

506

STS_List_506

MicroBlogList (MicroFeed)

 

544

STS_List_544

My Site Documents

MySiteDocumentLibrary

700

STS_List_MySiteDocumentLibrary

Product Catalog

 

751

STS_List_751

Pages Library               

Pages

850

STS_List_850

Asset Library / Video Channel

 

851

STS_List_851

Video Channel Settings

 

852

STS_List_852

Hub Settings

 

853

STS_List_853

Members - community site

 

880

STS_List_880

Issue Tracking List        

IssueTracking

1100

STS_List_IssueTracking

DraftAppsListTemplate

DeveloperSiteDraftApps

1230

STS_List_DeveloperSiteDraftApps

EDiscoverySources

 

1305

STS_List_1305

EDiscoverySourceGroups / Sets

 

1307

STS_List_1307

EDiscoveryCustodians

 

1308

STS_List_1308

Custom Lists / Queries

 

1309

STS_List_1309

EDiscoveryExports

 

1310

STS_List_1310

Slide Library

 

2100

STS_List_2100

Acquisition History List

 

10099

STS_List_10099

 

List Item ContentClass codes

For each of the above STS_List_nameornumber there is also an STS_ListItem_nameornumber that returns only items in that type of list.  Example: STS_ListItem_Announcements.

 

Improving Your Users Search Experience

Why? Do a web search on “time wasted searching”…

Most users won’t want to learn or type ContentClass queries; you will need to help them. You could add Search web parts to the home page of the team sites to find lists of things they might be interested in. Something like a list of “Sites you have access to…” or maybe a list of all recent announcements from all the sites they have access to. You could add links to the Quick Launch area that are just links to a search results page with an appended query string. The easiest way to create the link URL is to perform a search and then just copy the URL.  (Tip: Quick Launch will truncate any URLs that include a “#” character.  Many of the more advanced searches will include a “#Default” in the URL.)

You could of course create a cheat sheet with tips and tricks and include the most common ContentClass codes useful in your organization.

 

In Summary

In my digging through SharePoint 2013 I have found over 100 out of the box list types. Many of these are obsolete or hidden from the user and search. The above list expands the common list of 30 or so frequently published ContentClass codes to over 120. But it’s not complete. I know that I have missed a few as I have not used every possible current and legacy site template or list template. Also remember SharePoint continues to evolve, especially Office 365 / SharePoint Online. Please share any other ContentClass codes that you discover!

I am building an update to my old List Registration ID blog article that will include the 100+ list types, their version support, feature names and IDs, and ContentClass codes and their visibility to search. So visit my blog and search for “ContentClass”. 

 

About the author

Mike is a SharePoint nut, Senior Technical Instructor at MAX Technical Training, SharePoint MVP and courseware author. He has worn many IT hats over the last thirty years including business owner, developer, technical writer, trainer, DBA and consultant. Mike is a Microsoft Certified Trainer (MCT) and specializes in SharePoint, PowerShell, SQL Server and .NET development and is a member of the Cincinnati SharePoint User Group leadership team. He is the author of two SharePoint books: SharePoint 2010 Security for the Site Owner, and SharePoint 2007 and 2019 Customization for Site Owners. He has authored over 150 training/courseware titles over his career with 7 courseware titles currently published in the Microsoft Courseware Library, his latest courseware title is Microsoft SharePoint 2013 Search Administration. His blog: Mike Smith's Tech Training Notes, offers years of tips, tricks, advice and random discoveries about SharePoint, PowerShell and more. 

 

About MVP Monday

The MVP Monday Series is created by Melissa Travers. In this series we work to provide readers with a guest post from an MVP every Monday. Melissa is a Community Program Manager, formerly known as MVP Lead, for Messaging and Collaboration (Exchange, Lync, Office 365 and SharePoint) and Microsoft Dynamics in the US. She began her career at Microsoft as an Exchange Support Engineer and has been working with the technical community in some capacity for almost a decade. In her spare time she enjoys going to the gym, shopping for handbags, watching period and fantasy dramas, and spending time with her children and miniature Dachshund. Melissa lives in North Carolina and works out of the Microsoft Charlotte office.