Share via


Step 2: Deploy and Register the Custom Security Trimmer

This walkthrough describes how to create, deploy and register a custom security trimmer for Enterprise Search in Microsoft Office SharePoint Server 2007 by using Microsoft Visual Studio 2005.

Step 2 describes how to deploy and register the custom security trimmer, and includes the following tasks:

  • Deploying the custom security trimmer DLL

  • Creating the crawl rule for the security trimmer and registering the custom security trimmer for a Shared Services Provider (SSP) in Office SharePoint Server 2007

Deploying the Custom Security Trimmer DLL

Before you can register CustomSecurityTrimmer.dll, you must install it in the global assembly cache. There are several ways to do this. For more information, see How to: Install an Assembly into the Global Assembly Cache.

The following steps describe how to install the DLL to the global assembly cache by using the gacutil.exe command line utility. This utility is included with the Microsoft .NET Framework SDK. For more information, see Global Assembly Cache Tool (Gacutil.exe) and .NET Framework Tools.

To deploy the custom security trimmer DLL to the global assembly cache

  1. Click Start, point to All Programs, point to Microsoft .NET Framework SDK v2.0, and then click SDK Command Prompt.

  2. At the SDK command prompt, type the following command.

    gacutil /i /f <Path to Assembly>\CustomSecurityTrimmer.dll

  3. Replace <Path to Assembly> with the path to your DLL.

    If CustomSecurityTrimmer.dll is already installed to the global assembly cache, and you want to replace that version with a new version, use the /f option with the /i option, as follows.

    gacutil /i <Path to Assembly>\CustomSecurityTrimmer.dll /f

Creating the Crawl Rule and Registering the Custom Security Trimmer

Now that you're ready to register the custom security trimmer, you must create the crawl rule for the content that the custom security trimmer applies to.

To create the crawl rule

  1. Open SharePoint 3.0 Central Administration, and then navigate to the Application Management page.

  2. In the Office SharePoint Services Shared Services section of the Application Management page, click Create or Configure this Farm’s Shared Services.

  3. To open the administration site for the SSP, click the name of the SSP for the search service.

  4. In the Search section, click Search Settings to open the Configure Search Settings page.

  5. To open the Manage Crawl Rules page, click Crawl rules.

  6. Click New Crawl Rule, and then for Path, type file://FileServer1/*.

  7. For Crawl Configuration, select Include all items in this path, and then click OK to create the crawl rule.

You use the stsadm utility to register a custom security trimmer. The following procedure shows how to register a custom security trimmer, with the ID set to 1 for the SharedServices1 SSP, applied to content located on file shares for a server named FileServer1.

Note

This sample does not specify configuration properties for the security trimmer. For an example using configuration properties, see Step 3 (Optional): Specify a Configurable Limit on the Number of Crawl URLs Checked.

To register the custom security trimmer

  1. In Windows Explorer, locate CustomSecurityTrimmerSample.dll in the path <Local_Drive>:\WINDOWS\assembly.

  2. Right-click the file, and then click Properties.

  3. On the General tab in the Properties dialog box, select and copy the token.

  4. At a command prompt, type the following command.

    stsadm -o registersecuritytrimmer -ssp SharedServices1 -id 1 -typeName "CustomSecurityTrimmerSample.clsCustomSecurityTrimmer, CustomSecurityTrimmerSample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<token>" -rulepath file://FileServer1/*
    
  5. In the command, replace <token> with the Public Key Token for the CustomSecurityTrimmerSample.dll file.

After you register the security trimmer, you must re-create the affected content sources, and initiate a full crawl of that content source.

To re-create the content source

  1. Open SharePoint 3.0 Central Administration, and then navigate to the Application Management page.

  2. In the Office SharePoint Services Shared Services section of the Application Management page, click Create or Configure this Farm’s Shared Services.

  3. To open the administration site for the SSP, click the name of the SSP for the search service.

  4. In the Search section, to open the Configure Search Settings page, click Search Settings.

  5. To open the Manage Content Sources page, click Content sources and crawl schedules.

  6. For the content source representing the content affected by the crawl rule for the security trimmer, click the down arrow for Edit. From the menu, select Delete.

  7. To confirm deletion of the content source, click OK.

  8. Click Add Content Source, and then for Name, type the content source name.

  9. For Content Source Type, select File Shares.

  10. For Start Addresses, type file://FileServer1/*.

  11. Select Start full crawl of this content source, and then click OK to add the content source.

  12. Reset Microsoft Internet Information Services (IIS). At a command prompt, type iisreset.

See Also

Reference

Microsoft.Office.Server.Search.Query.ISecurityTrimmer

Concepts

Custom Security Trimming for Enterprise Search Results Overview
Walkthrough: Using a Custom Security Trimmer for Search Results
Step 1: Create the Custom Security Trimmer
Step 3 (Optional): Specify a Configurable Limit on the Number of Crawl URLs Checked