0
votes

Recently we have moved our web application from one server to another in Sharepoint 2010. Back up of entire web application was taken and restored in another server. But in the new server , the PDF files in the document library is not getting opened in browser. it always open in browser

I have already made following changes but didn,t work

  1. Set browser file handling to Permissive from central admin
  2. Set "open in browser" in setting s of doc library
  3. Set the doc library file handling property using $docLib = $web.lists["Your Document Library Title"] $docLib.BrowserFileHandling = "Permissive" $docLib.Update()

  4. Added "AllowedInlineDownloadedMimeType.Add("Application/Pdf") in web app

  5. Installed Adober eader in client machine

Even after trying all these, the PDF files are still opening in Client application(Adobe reader) but not in the browser

It would have been great help if anybody provide a solution for this. I have been banging head on this for two days

Regards

Vishnu

2

2 Answers

0
votes

You need to add the MIME type to SharePoint 2010 to enable this - and it needs to be done at Farm level.

The powershell on here will do it; (I've not run it, but it is Technet so source should be good)

# <#  
# .DESCRIPTION  
# 
#  This script adds new MIME type to "AllowedInlineDownloadedMimeTypes" property list     of defined SharePoint 2010 Web Application. 
# 
#  Script prompts you for MIME type and Web Application URL. 
# 
#  Code shall run in context of Farm Administrators group member. 
#  
# .NOTES  
#       File Name   : Add_MIME_Type.ps1  
#       Author      : Kamil Jurik, WBI Systems a.s.  
#       Created     : 11/12/2011  
#  

If ( (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction     SilentlyContinue) -eq $null ) { 
Add-PSSnapin "Microsoft.SharePoint.PowerShell" 
} 

Get-SPWebApplication 

$WebApp = Get-SPWebApplication $(Read-Host "`nEnter Web Application URL") 

Write-Host `n"Mime Type Examples:"`n"application/pdf, text/html, text/xml"`n 

If ($WebApp.AllowedInlineDownloadedMimeTypes -notcontains ($MimeType = Read-Host "Enter    a required mime type")) 
{ 
  Write-Host -ForegroundColor White `n"Adding" $MimeType "MIME Type to defined Web Application"$WebApp.url 
  $WebApp.AllowedInlineDownloadedMimeTypes.Add($MimeType) 
  $WebApp.Update() 
  Write-Host -ForegroundColor Green `n"The" $MimeType "MIME type has been successfully added." 
} Else { 
  Write-Host -ForegroundColor Red `n"The" $MimeType "MIME type has already been added." 
}