Click to Rate and Give Feedback
MSDN
MSDN Library
Office Development
SDK Documentation
General Reference
 Step 2: Deploy and Register the Cus...
Community Content
In this section
Statistics Annotations (5)
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 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

Community Content   What is Community Content?
Add new content RSS  Annotations
It works...but ONLY if crawl rule/path is limited to web application level!      koroshk   |   Edit   |   Show History
I've had success using these instructions but what if you don't want to have a rule path at the web application level (e.g. http://acme/*)? What if business rules require the rule path to be specific to a site collection (e.g. http://acme/site/widget/*)? I've run enough tests now to confirm that, although no errors are thrown, the trimmer simply does not trim if the rule path is that specific.

Any ideas would be greatly appreciated.

Tags What's this?: Add a tag
Flag as ContentBug
stsadm fails with error      szb ... Pascal Van Vlaenderen   |   Edit   |   Show History

Even with the changes suggested above i still get the following error when trying to use stsadm :
typename: Type 'CustomSecurityTrimmerSample.CustomSecurityTrimmer, CustomSecurityTrimmerSample, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=16190105a195408a' could not be loaded. Is the type and assembly registered in the GAC?

no idea what the problem is.

---- Prolly the publickey token is different. check it

Tags What's this?: Add a tag
Flag as ContentBug
Only wild card worked for me      adam.salah   |   Edit   |   Show History

I used http://* works fine

Tags What's this?: Add a tag
Flag as ContentBug
Rule Path error      siva4601   |   Edit   |   Show History
I gave rule path as -rulepath http://<SiteName>/* but struck error rulepath invalid error
Tags What's this?: Add a tag
Flag as ContentBug
Too BAD!      Jie Li - SharePoint   |   Edit   |   Show History

This content has too much errors. Those commands are wrong, you can't make anything success.

CustomSecurityTrimmerSample.clsCustomSecurityTrimmer is mistake. It should be CustomSecurityTrimmerSample.CustomSecurityTrimmer. I don't know why the writer added "cls" before the class name.

-rulepath file://FileServer1/* is another problem. It maybe invaild. The output message is no use. You must first create the content source with this rulepath otherwise the trimmer can’t be registered.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker