Archive

Posts Tagged ‘SharePoint Document Library’

How to display icons like CSV and PDF in your SharePoint document library.

July 7, 2011 Leave a comment

Here is a simple trick:
Oh, this must be done on all Web Front End Servers. You don’t want someone hitting a server that doesn’t have this added.
CSV icon

Upload a .csv file. You see the icon displayed for it in a document library is just a little white page. If you want to show the Microsoft Excel .csv icon for these files do this:

  1. Open the 14 hive (12 hive for MOSS 2007).
    1. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML
  2. Open the DOCICON.XML file with Notepad.
  3. Add following line in the <ByExtension> node:
    <Mapping Key=”csv” Value=”CSV16.GIF” EditText=”Microsoft Office Excel” OpenControl=”SharePoint.OpenDocuments” />
  4. Execute an iisreset

 

PDF

  1. Install PDF Filter Using PowerShell

    SharePoint 2010 doesn’t support PDF files by default. You can solve this by
    installing Adobe PDF iFilter 9 for 64-bit platforms and following the steps
    described below. First, you can download PDFFilter64installer.msi: http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025

    You’ll also need an icon that will be used in SharePoint 2010 for PDF files:

    http://www.mossgurus.com/adnan/Documents/pdf16.gif

    Next, start PowerShell and run the
    following command to install the MSI Package and configure SharePoint 2010:

    # Install MSI

    PS > $iFilter = “C:\Media\IFilter\PDFFilter64installer.msi”

    PS > Start-Process -FilePath $IFIlter -ArgumentList “/quiet” –Wait

     

    # Copy Icon to SharePoint Folder

    PS > $icon = “C:\Media\IFilter\pdf16.gif”

    PS > Copy-Item -Path $Icon -Destination “C:\Program
    Files\Common Files\Microsoft Shared\Web Server
    Extensions\14\TEMPLATE\IMAGES”

     

    # Modify DocIcon.xml

    PS > $path = “C:\Program
    Files\Common Files\Microsoft Shared\Web Server
    Extensions\14\TEMPLATE\XML\DOCICON.XML”

    PS > $xml = New-Object XML

    PS > $xml.Load($path)

    PS > $element = $xml.CreateElement(“Mapping”)

    PS > $element.SetAttribute(“Key”,”pdf”)

    PS > $element.SetAttribute(“Value”,”pdf16.gif”)

    PS > $xml.DocIcons.ByExtension.AppendChild($element) | Out-Null

    PS > $xml.Save($path)

     

    # Add PDF type to Search Service
    Application

    PS > New-SPEnterpriseSearchCrawlExtension -Name “pdf” `

    >> -SearchApplication SearchServiceApp

     

    # Modify Registry

    PS > mkdir ‘HKLM:\SOFTWARE\Microsoft\Office
    Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf

    PS > Get-Item ‘HKLM:\SOFTWARE\Microsoft\Office
    Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf
    ‘ | >> Set-ItemProperty -Name “(default)” `

    >> -Value “{E8978DA6-047F-4E3D-9C78-CDBE46041603}”

    # Restart Search Service

    Get-Service | Where-Object { $_.Name -eq “OSearch14” } |

    >> Restart-Service

Enjoy!

Tim

@tdrsma