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
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.
Click Start, point to All Programs, point to Microsoft .NET Framework SDK v2.0, and then click SDK Command Prompt.
At the SDK command prompt, type the following command.
gacutil /i /f <Path to Assembly>\CustomSecurityTrimmer.dll
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
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.
Open SharePoint 3.0 Central Administration, and then navigate to the Application Management page.
In the Office SharePoint Services Shared Services section of the Application Management page, click Create or Configure this Farm’s Shared Services.
To open the administration site for the SSP, click the name of the SSP for the search service.
In the Search section, click Search Settings to open the Configure Search Settings page.
To open the Manage Crawl Rules page, click Crawl rules.
Click New Crawl Rule, and then for Path, type file://FileServer1/*.
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.
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.
In Windows Explorer, locate CustomSecurityTrimmerSample.dll in the path <Local_Drive>:\WINDOWS\assembly.
:\WINDOWS\assembly
Right-click the file, and then click Properties.
On the General tab in the Properties dialog box, select and copy the token.
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/*
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.
In the Search section, to open the Configure Search Settings page, click Search Settings.
To open the Manage Content Sources page, click Content sources and crawl schedules.
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.
To confirm deletion of the content source, click OK.
Click Add Content Source, and then for Name, type the content source name.
For Content Source Type, select File Shares.
For Start Addresses, type file://FileServer1/*.
Select Start full crawl of this content source, and then click OK to add the content source.
Reset Microsoft Internet Information Services (IIS). At a command prompt, type iisreset.
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
I used http://* works fine
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.