Joseph Michael Pesch
VP Programming

Open PDF in Sharepoint 2010

by 16. July 2012 17:02

We added an editable PDF document to our Sharepoint 2010 site; however, under the sites default settings it forced the user to save the document (i.e. it would not open the document directly from the site).  Below is a PowerShell script that will add the PDF MIME type to the list of allowable inline download types.  NOTE: Save the script with .PS1 extension to run in PowerShell.

$webapp = Get-SPWebApplication http://sharepointsitehere
If ($webapp.AllowedInlineDownloadedMimeTypes -notcontains "application/pdf")
{
  Write-Host -ForegroundColor White "Adding Pdf MIME Type..."
  $webapp.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
  $webapp.Update()
  Write-Host -ForegroundColor White "Added and saved."
}
 Else
{
  Write-Host -ForegroundColor White "Pdf MIME type is already added."
}

Tags:

Sharepoint | PowerShell

Comments are closed