Building, Running, and Using the Tool

Sep 24, 2008 at 9:53 PM

In order to rebuild the solution, you must obtain Microsoft.SharePoint.dll and update the corresponding assembly reference. Otherwise, the compiler won't be able to resolve the "using Microsoft.SharePoint" directive. The dll is available from any machine with SharePoint or MOSS installed. If either of the latter are installed on your developer machine, you may be able to disregard this note.

Regarding run-time requirements, the above dll must be registered in the GAC. If you're running the tool on the SharePoint server machine, that's already been done. Also, the tool requires the Microsoft Office run-time components, since it opens each document it finds in order to search it.

Testing has been performend on Microsoft Office SharePoint Server 2007 running on Windows Server 2003 Standard. The Word, Excel, and PowerPoint components of Office 2007 Ultimate were also installed in the test environment.

Sample Usage
The default output of the tool is as follows.

SharepointSearch.exe siteUrl regularExpression
 Example: to search for the appearance of a Social Security Number:
 SharepointSearch.exe http://localhost/Docs \d{3}-\d{2}-\d{4}

For example, the following command-line and resulting output is for a test MOSS server named ws08std1. The default document repository location of Docs is used. The search pattern is for US Social Security Numbers. An Excel 2007 document is found which contains two SSNs.

>SharepointSearch.exe http://ws03std1/Docs \d{3}-\d{2}-\d{4}
Search office documents on site http://ws03std1/Docs for \d{3}-\d{2}-\d{4}:
987-65-4321,http://ws03std1/Docs/Documents/SecretSensitiveStuff.xlsx,cell(2 1)
123-45-6789,http://ws03std1/Docs/Documents/SecretSensitiveStuff.xlsx,cell(3 1)

By the way, a good introduction to the .NET regular expression syntax, as well as useful samples, can be found here.