in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, Office 365 / SharePoint Online and Visual Studio 2013.

How to: Create a Scope for a custom List Template Type

In Enterprise Search, I often find it useful to create a scope around a specific list template.  This gives users added flexibility in searching only specific lists of documents, list items, pages or whatever.  I think there are a few ways to do this, but one way I have found to do this is by using the List Template Id.  Say you have a simple list template like the following.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <ListTemplate

      Name="MyDocumentLibrary"

      Type="10003"

      BaseType="1"

      OnQuickLaunch="TRUE"

      SecurityBits="11"

      Sequence="110"

      DisplayName="My Document Library"

      Description="My Custom Document Library"

      Image="/_layouts/images/itdl.gif"

      DocumentTemplate="101"

      DisallowContentTypes="false"

      MultipleTypes="true"

      VersioningEnabled="true"

      FolderCreation="false"

        />

</Elements>

To create a scope to only return items that are in this type of list, we use the contentclass managed property.  For built-in list types, you can create a rule in your scope, specifying a property query with a contentclass value of STS_List_Tasks or STS_List_Links for example.  This post has a list of the various built-in values you can use for out-of-the-box list template types.  Configuring a scope for a custom list template type is also pretty easy assuming you know the syntax.  You simply append the type id to STS_ListItem_.  For example, in the case of my list template above, my contentclass would be.

STS_ListItem_10003

Just go to your SSP –> Search Administration –> Scopes.  Create a new scope and a new rule and then set the Scope Rule Type to Property Query.  Pick contentclass from the box and enter a value like the one above.  Also be sure and select the Require behavior to require items to have that content class.  Here is what it would look like.

ScopeListTemplate

EDIT: I need to update the image to show ContentClass instead of Author.

It’s pretty simple.  I am not sure how I figured out how to do this, but it does work.  It might be buried in the SDK somewhere.  I think you could also specify built-in lists using their list template id’s as well.

Follow me on twitter.

Comments

 

How to: Create a Scope for a custom List Template Type - Corey … « live.exofire.net said:

Pingback from  How to: Create a Scope for a custom List Template Type - Corey &#8230; &laquo;  live.exofire.net

March 31, 2009 10:18 PM
 

ran said:

Hi,

no matter what STS_* i put i get 0 result .

i have 22000 item crawled.

Any ideas?

July 8, 2010 6:55 AM
 

Excluding Publishing Image Libraries from Search results said:

Pingback from  Excluding Publishing Image Libraries from Search results

September 11, 2013 2:40 PM

Leave a Comment

(required)  
(optional)
(required)  
Add

About CoreyRoth

Corey Roth is an Applications Architect at Infusion specializing in ECM and Search.
2012 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems