How To: Create Content Sources, Search Scope and Use the MOSS Object Model for Search 1

Part 1 of a 5 Part Series:

Part 1: How to Setup a Content Source, Search Scope in the SSP and Consume that Scope in a Site Collection
Part 2:  Coding Enterprise Search – Examining Content Sources, Scopes, etc
Part 3: 
Part 4
Part 5



In this blog we will go about how to create a Content Source in the Shared Services Provider, we will create a File Share Content Source and a SSP Search Scope that may be consumed by Site Collection Administrators.  Once we complete that we will take a look into how one could enhance their search experience by a using the MOSS Object Model and Search Objects to further customize that experience. This will be a 5 Part Series and this Part 1 will cover up to Returning a list of Content Sources from the SSP we set up in this Farm.

Step 1: Crack open the Central Administrator Portal and click on you Shared Service Provider (SSP) in this instance it is called SSP1


Step 2:  Click on Search Settings


Step 3: Click on Content Sources and Crawl Schedule

In this instance we have the default Content Source that comes OOB which is ALL the SharePoint Sites on the Farm


Step 4:  Click “New Content Source”

You will be presented with a few options here. You may:

  1. create additional SharePoint Sites Content Sources
  2. create Web Sites Content Sources that are NOT SharePoint sites, such as Intranet Sites, Internet Sites, etc
  3. create File Share Content Sources;this is what we will be doing in this example. We will create a directory on the server share it out and use it as a content source. You must provide your Crawl Account read access to this directory
  4. create Exchange Public Folders Content Sources
  5. create Business Data Content Sources i.e. Line of Business (LOB) Data in the Business Data Catalog (BDC) and turning on the flag/attribute for “Making the business data searchable”


Step 5: First to do the above we need a location to Search for Step 4.3

I created a Folder called “AreaforSearchCrawl” on my hard disk. I Shared it out under the same name and ensured that the Security Permission had my Crawl Account “svcSharePointCrawl” added for “Read-Only” permission on the folder for both Security and Sharing NTFS Permission.


Step 6:  Next we do the following:

  1. provide a Name for the Content Source – Just Stuff
  2. select what type of Content Source this is – File Share
  3. provide the start address for the location notice that this is a UNC path name – fabianw2k3r2AreaforSearchCrawl
  4. and I created a Crawl Schedule for both Full and Incremental Crawls


Step 7:  So now as we saw in Step 3 we have another Content Source called Just Stuff and because i selected the check box for “Start full crawl of this content source above” [i didnt screen shot that sorry], we see that the crawl is underway and we have a new Content Source called Just Stuff


Step 8: From Search Administration click on Scopes, you will be presented with the screen below.  Notice only two Scopes now (1) AllSites and (2) All People but since I have not configured my Profile Import with any Profile Source (AD, LDAP, Business Data,etc ), my People is set to 0.


Step 9:  Click “New Scope” and we will create a scope called “Just Stuff Scope” as denoted below and set the new Scope to the Content Source of the “Just Stuff” we created earlier


Step 10:  Notice now we have three (3) Scopes below


Step 11:  A closer look at the Search Scope we created and notice the Rule sets the Content Source to the one we did not too long ago.


Step 12:  Examining the Crawl Log we see that our crawl was successful and yielded 1157 items


Step 13:  Further examination of the Crawl Log will show additional detailed information regarding exactly what was crawled and the outcome



Step 14: Now we leave Central Admin (CA) and go to our Collaboration Publishing Portal and at the Top Level Site Collection we choose “Site Action”, then “Site Settings” which takes us to the screen below. Click “Search Scope” once you are there.


Step 15:  You will notice that the Scope you created in the SSP is present but set inside the “Unused Scope” Display Group.  This is because we have not yet decided where to consume that scope.  We can either:

  • Add it to an existing Display Group
  • Create a new Display Group and Add it there.

I am going to demonstrate both options


Step 16:  In this step we will create a NEW Display Group and add the Just Stuff Scope to it by clicking on”New Scope” and filling out the text boxes as denoted below


Step 17:  Below you will see not only that we have the new display group we created above but we also added the Search Scope to he Search Dropdown Display Group


Step 18:  Once the Timer Service runs you will see that a new Scope Item called “Just Stuff Scope” is added to your options from your Search Window Pane as denoted below


Step 19:  Doing a search for “Fabian Williams” yielded the below results and notice they all come from the Content Source not the SharePoint Sites


Step Alpha: Cracking Open Visual Studio so we can use the Object Model to examine our Content Source —- TEASER — 

The steps taken are below:

  • I created a Standard Windows Application using C#
  • Set References to the following so I can use the SharePoint Object Model [Note: these DLL’s are found in the ISAPI folder in the 12 hive]
    • Microsoft.Office.SharePoint
    • Microsoft.Office.Server.Search
    • Microsoft.SharePoint
    • Microsoft.SharePoint.Search


Step Bravo:  Create a Generic Form

  • I used a Label Control just to show what should occupy the text box
  • I used a Text Box to capture the Top Level Site Collection that I want to get the SSP For
  • I used a Button to execute my code
  • I used a List Box to display the results


Step Charlie:  Code to render the Results —- TEASER — we will go into this in Part II


Step Delta:  Result from the Code —- TEASER — we will go into this in Part II


Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “How To: Create Content Sources, Search Scope and Use the MOSS Object Model for Search