Solved

Trying to link directly to document in document library

  • 22 June 2016
  • 5 replies
  • 144 views

Userlevel 5
Badge +13

We have a document library of organization policies which are reviewed annually/semi-annually/bi-annualy, etc. A site workflow checks for ones where NextReviewDate=Today and kicks it to "Expired" which initiates a series of approval workflows. In the approval workflows, we email stakeholders and let them know they need to review and approve the policy, then change their Approval Status (this field change triggers the next step of the workflow). I'd like to, in the email, link them to both the Display Form (which I've accomplished) as well as the document in Word Online. I can't figure out how to build the link to the Word Online document. Anyone else have experience with this or a solution? I would also be happy with putting a button on the form to "go to document" or whatever.

icon

Best answer by andrewg 28 June 2016, 05:13

View original

5 replies

Badge +17

Courtney replied on another thread, but the basics would be in the site workflow to query the doc library, grab the shortcut url or short url and push those into a collection. Then parse the collection and extract that for the document url you need and put that in the email.

While using a site workflow to start the review process, if you use a workflow on the document to do the approval process, the task form should be linked to the document that started that, meaning the review form should have a link to the document itself.

Userlevel 5
Badge +13

Hey Eric, currently, all "Current Item" links are going to the properties of the document. None of those actually opens the doc in Word Online. I can get the link to /doclib/yourDocument.docx, but that initiates a download. I tried to append things on that similarly to this article/demo​ and couldn't figure out the exact configuration to make it work.

The Site Workflow that checks for nextReviewDate == Today *does* query the list and pulls the ID (so it can start the kickoff WF on each item that meets the criteria) as well as the Title (so I can see those in the logs). I can certainly have it pull a URL, but again, it pulls the properties, not the actual document open in Word Online. 2016-06-24_9-08-45.png

This is how the URL looks when the item is open in Word Online. I'm not sure what the stuff insourcedoc={ } is, as it's not the GUID.

To clarify, the site workflow only serves to check for nextReviewDate == Today and then kicks off a library workflow and all approval  workflows are on the library, not the site.

Userlevel 7
Badge +17

What happens if you take the absolute link to the document within the library, then add to it ?web=1.

Then send it in an email with this link and the document should open in Office Web Apps.

for example:   https://company.sharepoint.com/sites/site/shared documents/folder/myworddoc.docx?web=1

Userlevel 5
Badge +13

That worked, Andrew, thank you so much!

Badge +6

Will this still work if someone was to change the name of the document after the email went out? 

Reply