I have many data view web parts on a SharePoint Online Office 365 site. These generate lists of documents from multiple document libraries based on common meta data. The links on the lists worked fine up until December. This issue now is that the sites are using the modern PDF viewer.

The links that are generated use "action=default" to open the file. The Microsoft file types (word, etc.) are handled fine and open correctly. The PDF links now only take you to the folder where the file sits. They used to open fine, but it would seem that the way PDFs are handled to display in the modern PDF viewer does not work the way it used to.

I have tried Microsoft support to see if I could force the classic method of opening a PDF but they have told me it is not possible, and since I developed these web parts in SharePoint Designer they cannot support me.

So I have to rework my code in SharePoint Designer to match the URLs created by SharePoint to open PDFs.

  1. What is the new format for the link? (i.e. what info do I need to build the link and what is the formula)

  2. How can I get the code to check whether the file type is PDF or not and build the URL respectively?

Thanks in Advance!

1 Answer 1


Create a new collun, text. Then creating a sharepoint workflow to build the URL ag=fter file is submited. This way you can check if it has .pdf extension and process it

  • I think I understand you. Do you mean create a text field column for the document library and use a workflow to create and store the URL, rather than build the URL in SharePoint designer on page load? Mar 26, 2018 at 0:12
  • I'd also like to ask if there would be a way to make this link dynamic? I can only think if the name of the document changes, the link will no longer work. This would mean running the same workflow every time a document is changed, whether or not the name was edited, wouldn't it? Mar 26, 2018 at 3:47
  • Yes. But since you are using a workflow everytime you change the file workflow update the field
    – user70011
    Mar 26, 2018 at 6:36
  • I'm worried that would be overkill - we have a lot of documents that get edited everyday. How taxing would this be on SharePoint speed and responsiveness? Mar 27, 2018 at 6:06
  • Yes I got your point. I did a job for a HR depto with a tousand operations and its is true workflow performance coul be a problem not for the workflow itself but the time it takes to start. I solved my situation creating a custom HTML that calls a JSOM SharePoint than it make the right url before send it to server. You can archive it alson with a event reciver or with information police workflow. But you can give a sharePoint Std workflow a try and make a test.I didi it for a Oil company tahat have to upload thousand images everyday and has a modern sharepoint site,
    – user70011
    Mar 27, 2018 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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