0

We had an issue last week with our users getting pop-up prompts for permissions when trying to save Office 2013 documents from our SharePoint server.

The fix I implemented was to

Go into IIS, select the site, go under Request Filtering, and added OPTIONS: False and PROPFIND: False.

This made the prompt disappear in Office docs. Now the users can't open PDFs. They get a pop-up window from Adobe (Acrobat or Reader):

There was an error opening this document. "The filename, directory name, or volume label syntax is incorrect."

I and the other domain admin do NOT get this prompt, the document opens without issue.

Seems to be a rights issue, but the only thing I've changed in the past while was the reference at the start of the post.

0

It may be an issue related to having pdfs (and office docs) as editable files. We had this issue with excel docs. One workaround that I found online was to use the download.aspx to parse the excel doc links so that they look like this:

original link to excel doc: http://mysitedotcom/pathtosite/Documents/excel.xlsx

parsed and modified URL:

 http://mysitedotcom/pathtosite/_layouts/15/download.aspx?SourceUrl=/pathtosite/Documents/excel.xlsx&FldUrl=&Source=http://mysitedotcom/pathtosite/Documents/Forms/AllItems.aspx

This enabled our users to bypass the login prompt on SP2013 for excel docs and provided them with a download prompt instead.

Here is the script I made so that any excel doc that gets linked gets parsed into this automatically: Begins the function to search all the hrefs for XLS or XLSX files:

$(document).ready(function(){ $('a[href$=".xlsx"], a[href$=".xls"]').each(function() {.........

This is the main gist of the URL manipulation (14 is the number of characters of yourdomain.com before the path to the site begins:

if (testHTTP === 1) {
        startOfPathToSite = excelURL.indexOf("yourdomain.com") + 14;
        }
        else {
        startOfPathToSite = 0;
        }
        /* Determines the end of slicing the subsite path by finding the point before the Documents library */
        endOfPathToSite = excelURL.indexOf("/Documents/");
        /* Slices the start and end point of the subsite within the href. */
        pathToSite = excelURL.slice(startOfPathToSite, endOfPathToSite);
        /* Puts it all together in finalModifiedExcelURL. (downloadAspx, fieldURL, "/Documents/Forms/AllItems.aspx" are the static portions of the excel URL fix) */
        var downloadAspx = "/_layouts/15/download.aspx?SourceUrl=";
        var midDocPath = excelURL.slice(startOfPathToSite);
        var fieldURL = "&FldUrl=&Source=";
        var lastPart = siteDomain + pathToSite + "/Documents/Forms/AllItems.aspx";
        finalModifiedExcelURL = siteDomain + pathToSite + downloadAspx + midDocPath + fieldURL + lastPart;
 }

This basically replaces the href value that $.each() iterated on:

$(this).attr('href', finalModifiedExcelURL);

For your PDF issue, would setting a target="_blank" fix your PDF issue? If so, this jquery might help:

$(function(){
    $('a[href$=".pdf"]').attr('target','_blank');
});

Anyways, hope this helps! -Sung

| improve this answer | |
  • Bear with me, I'm not quite sure how to implement this fix. I believe you are completely correct in your assumption to the cause - as soon as I removed the two fixes I put in last week the PDF could be viewed, but the credential prompt reappeared. – clicker666 Jul 27 '16 at 12:36
  • I see two copies of download.aspx on the machine and they both are the same. They show very little inside (and I'm not sure what to add): '<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages" %> <%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.Download" %> ' @-Sung – clicker666 Jul 27 '16 at 12:45
  • I should have been clearer. This is for a front facing site. We have something similar to the above code in a .js file. This js file is called in a <link...> tag of our masterpages. This way, whenever someone loads any of our pages and it has excel or pdf links, this js will dynamically/on-the-fly modify the <a...> tags with the appropriate URL modifications (for excel) or a target="_blank" (for pdfs). – nakji Jul 27 '16 at 22:36
  • Oh, I see. This is for an internal Sharepoint site. An intranet portal. Everyone accessing it has the appropriate permissions to access the site, and there is no anonymous access - so any code that we could plug into it to do this would be appreciated. – clicker666 Jul 29 '16 at 11:23

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.