SharePoint document libraries are phenomenal tools for collaborative environments where files are shared. And SharePoint's ability to search files in document libraries makes finding files easy. Well, unless the document is a non-Microsoft file type, such as the ever-present PDF file.

The sad fact of the matter is that Windows SharePoint Services (WSS) 3.0 and Microsoft Office SharePoint Server (MOSS) 2007 can't index PDFs by default. That's not news to many veteran SharePoint professionals. Nor is the fact that you can add an icon for PDFs, reindex existing documents, and so forth. However, many administrators are new to SharePoint, and will hit their heads hard against this problem. I was disappointed to see that, despite extensive searching on Google, I could find no single, authoritative, and (most importantly) complete guide for how to do so.

The "bottom line" is that you must install an iFilter for PDFs on your SharePoint servers--specifically, any server that performs search, which would be all WSS servers and your MOSS search server. iFilters are plug-ins that enable indexing of file types. Although iFilter is a Microsoft specification, it is generally through vendors or third parties that you'll get iFilters--not through Microsoft itself.

After you add the iFilter, you must configure SharePoint to index the file type (.PDF). But then, you still have two problems. The biggest is that SharePoint will index only files that are added or existing files whose properties change. So SharePoint will not index existing PDFs when you add the PDF iFilter. You must rebuild your index. The second challenge, purely a cosmetic one, is that you enable SharePoint to display an appropriate icon for PDFs.

This installment will focus on 32-bit WSS servers. Next time we'll look at MOSS and 64-bit servers.

Figure 1 shows the baseline--a document library with a Word document and a PDF. Note the PDF doesn't display an icon.

Figure 1: A PDF in a document library with no icon

Both of these documents contain the word "iFilter" in them, but a search produces only the Word document, as Figure 2 shows.

2. Install the iFilter. Note: Many guides on the Internet suggest shutting down Microsoft IIS or the Shared Service Provider (SSP) or the WSS application(s). I found this was not necessary, and Microsoft's own KB article 927675 did not specify it was necessary.

3. Add a registry entry for the .pdf extension in the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Applications\<GUID>\Gather\Search\Extensions\ExtensionList. (Open the registry editor. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Applications\<GUID>\Gather\Search\Extensions\ExtensionList\. Identify the highest "number" value in the key. On a default installation of WSS, the highest entry is 37. Note they are not sorted in numeric order because registry value names are strings. Create a registry value for the next number, e.g. 38, by choosing Edit à New à String Value then naming the value the next highest number (e.g. 38). Double-click the value you just created and, in the Value Data box, type: pdf. Note there is no dot preceding the extension.

4. There are two registry keys with specific values that must exist. Verify that these exist and, if not, create them:

Perform a search, and existing PDFs will not be returned. But newly added PDFs will (once indexed by SharePoint) appear in search results. If you modify any property of an existing PDF, it will be indexed. But who wants to modify all existing PDFs in a document library? This is where I found a lot of misinformation online. Even Microsoft's KB 927675 didn't suggest the right solution! It's easy! STSADM, SharePoint's ubercommand, to the rescue!

6. Rebuild the WSS search index.

- Open a command prompt.
- Navigate to Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN and type the following commands

stsadm.exe -o spsearch -action fullcrawlstop

stsadm.exe -o spsearch -action fullcrawlstart

The existing PDFs will, after being indexed, appear in search results. But they will still not have correct icons. So, while your site is being indexed, keep going with these steps to configure the icon.

7. Open the folder Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images.

8. Copy the gif you downloaded in Step 1 into the folder.

9. Open the folder Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml.

10. Right-click the file docicon.xml and choose Open With and select Notepad.

11. In the <ByExtension> element, you'll see a number of <Mapping Key> elements. You will add one for pdf. It does not have to be in alphabetical order. The element you need to add is:

<Mapping Key="pdf" Value="pdficon_small.gif" OpenControl=""/>

12. Save that file and close Notepad.

Now, the moment of truth. A search now provides the results shown in Figure 3.