Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Create SharePoint Result Sources Filtered by Parent Content Type


A little post to describe how I can create a Sharepoint Search Result Search in order to display Document based on a specific parent content type only.


A content type is a group of reusable settings that describe the shared attributes and behaviors for a specific kind of content.
https://support.office.com/en-us/article/introduction-to-content-types-and-content-type-publishing-a5026d23-8df8-42f6-b0d6-1920880c0d03

Each content type is identified by a code which identifies uniquely a specific content type within a site collection. This code is represented by a string like this:

0x010100D5C2F139516B419D801AC2C18942334D
Where
0x is System
0x01 is Item
0x0101 is Document

Then: if I find a content type id which starts with 0x0101, I can tell that this content type inherits from document content type.

When I create a Site Content Type based on Document content type, the format of Content Type Id will be like this
0x010100E86DF1885AC16D4DB58C7A456C564665

To the Document content type id (0x0101) SharePoint appends double 0 (00) and a Guid without minus (-).

When I apply this content type to one or more document library, SharePoint will create a new content type based on its parent with a code like this
0x010100E86DF1885AC16D4DB58C7A456C564665005562F5CEA2F95D43AB90A4AF6951413D

My parent content type, 00, a new Guid without minus: each time I’ll apply this content type to a new library, it will have the same content type id root (the parent content type ID).

0x010100E86DF1885AC16D4DB58C7A456C5646650049ACB072808546469575B50A85946508
0x010100E86DF1885AC16D4DB58C7A456C5646650028F82F1F333544369CD1AC723429A4E8

Now a real case:
I create a SharePoint site in order to store several types of documents:
  • Invoices
  • Offers
  • Orders

For the Invoices documents I decided to create different document libraries, for example, one for each product group of my company; obviously I create a Site Content Type named Invoice whose content type id is 
0x010100E86DF1885AC16D4DB58C7A456C564665

Now, once I applied this content type to all my invoices document libraries, I’ll get several children content types with the same prefix content type id of the parent.

0x010100E86DF1885AC16D4DB58C7A456C564665005562F5CEA2F95D43AB90A4AF6951413D
0x010100E86DF1885AC16D4DB58C7A456C5646650028F82F1F333544369CD1AC723429A4E8

(I can see the content type id in the browser url bar when I navigate to the Manage Content Type page, parameter ctype
https://asdasd.sharepoint.com/sites/TestRusso/_layouts/15/ManageContentType.aspx?List=%7BB66D8D6A%2DCA8D%2D41F7%2DB315%2D1DC11A4CB864%7D&ctype=0x010100E86DF1885AC16D4DB58C7A456C564665005562F5CEA2F95D43AB90A4AF6951413D
)

Now I come to the heart of the matter after this “pistolotto”.

I need to create a Seach Result Source in order to allow secretaries to easily find invoice documents in any document library: my search result must report only document based on Invoice content type.
I tried to use the Query Transform Builder but without success.

Here the string I have to type inside the Query Transform Textbox

 (ContentTypeId: 0x010100E86DF1885AC16D4DB58C7A456C564665*) {searchTerms}

Where the parameter ContentTypeId is the ID of my parent content type.
In this way, I’ll get in the search result all documents based on this content type: in our case, all the invoices stored in any document library.




This post first appeared on ZSvipullo, please read the originial post: here

Share the post

Create SharePoint Result Sources Filtered by Parent Content Type

×

Subscribe to Zsvipullo

Get updates delivered right to your inbox!

Thank you for your subscription

×