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

Posted Tuesday, March 31, 2009 1:45 PM by CoreyRoth

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 &#8230; &laquo; live.exofire.net

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

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

Thursday, July 8, 2010 6:55 AM by ran

Hi,

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

i have 22000 item crawled.

Any ideas?

# Excluding Publishing Image Libraries from Search results

Wednesday, September 11, 2013 2:40 PM by Excluding Publishing Image Libraries from Search results

Pingback from  Excluding Publishing Image Libraries from Search results

Leave a Comment

(required)
(required)
(optional)
(required)