0

I am uploading new .pdf versions of documents and they are just loading as new documents.

Yes I am making sure the titles are EXACTLY the same, they are both pdf (although the icon appears to be different) and I am checking add as new version to existing.

Attached Example Org charts

Also When I click on the document - where before it would open in the browser it now downloads it (which I don't want to happen automatically).

Any suggestions??

Many thanks

1

Create a event receiver for ItemUpdating and attach to the document library and see the below code it will not update the document, if its already exists in the library then throws an error.

    public override void ItemUpdating(SPItemEventProperties properties)
    {
        base.ItemUpdating(properties);
        if (properties.ListItem.File.Exists)
        {
            properties.ErrorMessage = "File Allready exists uploaded by other user.";
            properties.Status = SPEventReceiverStatus.CancelWithError;
            properties.Cancel = true;

        }

OR

This is due to the security behind the "Browser File Handling" option in the General Settings of a Web Application. If you want all files to open in their respective program (as they did in SharePoint 2007):

Go to Central Administration -> Application Management -> Manage Web Applications

Highlight the target Web application and click on "General Settings" in the Manage group of the ribbon

In the "Browser File Handling" section of the "Web Application General Settings" screen, change the radio button from "Strict" to "Permissive" (note that "Strict" is the default)

Click OK

Visit the previously offending document library in the browser - your files should now open in the respective application without prompting to save.

For full disclosure, the above procedure effectively allows all file types to be opened without being prompted to save. You can still keep "Strict" enabled and allow open for specific file types without having to open it up for all files. This is done against a specific MIME type.

An example changing this specifically for PDF documents in PowerShell using the SharePoint Management Shell:

$gc = Start-SPAssignment

$targetType = "application/pdf"

$webApp = $gc | Get-SPWebApplication http://yourwebappurl

If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains $targetType)

{

 $webApp.AllowedInlineDownloadedMimeTypes.Add($targetType)

 $webApp.Update()

}

$gc | Stop-SPAssignment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.