Wednesday, April 11, 2012

Open PDF files in browser


In SharePoint when you try to open a PDF you are forced to download the file. Downloading can be avoided. To fix this we need to do some config changes in Central Admin. There are two options to achieve the same
First option –
  • Go to Central Administration > Application Management > Manage web application under web application
  • Select the web application then click on general settings from Ribbon > then Change “Browser File Handling” to Permissive.
  • Click Ok.
  • Do an IISRESET
Note - From a security point of view I don't think it is a good idea to change the 'Browser File Handling' to 'Permissive'.

Here is another option to allow PDF to be opened in browser from Sharepoint.

  1. Open the "SharePoint 2010 Management Shell", running as Farm Administrator;
  2. Execute the following commands – (Replace < YourSiteURL> with your web application url)  

$webApp = Get-SPWebApplication http://YourSiteURL
$webApp.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
$webApp.Update()

           Or you can save as PowerShell script and execute that
            Here is script  

           $webApp = Get-SPWebApplication http://YourSiteURL
           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 " Pdf MIME Type added and saved."
            } 
            Else {
                  Write-Host -ForegroundColor White "Pdf MIME type is already added."
            }

      3. Do an IISRESET.

if you want to open an .msg file, or other file type saved in SharePoint without being asked to download it first; you just have to change the MIME type.
Like for .msg file $webApp.AllowedInlineDownloadedMimeTypes.Add("application/vnd.ms-outlook")

Hope that helps anyone out there.

Thursday, April 5, 2012

SharePoint prompts user for credentials (login/password)


In MOSS - I found this could be due to following reasons:
  1. If you are not using proper authentication in IIS for web app, in this use integrated authentication.
  2. It may due to proxy settings(if you are using a proxy server (intranet)) , in this case go to tools in IE--> internet options --> connection--.LAN settings --> advanced --.> exception. Add the site over there.
  3. If you have sync setup with mysite or lists with your outlook, in this remove it from your Outlook profile.
  4. due to IE unable to authenticate user when using IE 7 and 8 with SP 2007.  To fix that follow these steps.
  • Go to Internet Options -> Security tab
  • Select Trusted sites Zone -> Click on Sites ->Add the SP site to Trusted Sites. (http://*.yourdomain)
  • Then check the settings under Custom Level (for trusted sites) - scroll to the bottom and look at the Security settings for User Authentication. Make sure it's set to Auto Logon with current user name and password.
  • Click OK and OK again. Restart IE and try your site.
If SharePoint prompt when opening Office documents, try this registry change:
  1. Click Start, type regedit in the Start Search box, and then press ENTER.
  2. Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters
  3. On the Edit menu, point to New, and then click Multi-String Value.
  4. Type AuthForwardServerList, and then press ENTER.
  5. On the Edit menu, click Modify.
  6. In the Value data box, type in the following:
  7. http://*.your domain
  8. Exit Registry Editor