cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
syed_sme
Helper I
Helper I

sharepoint list column hyperlink to open excel file online

Hi Everyone,

 

I have a sharepoint list which has a hyperlink column. The link to the excel file is generated by a power automate flow (an update item action) which currently downloads/opens in the desktop app. I would like the excel file to open in the browser, in a new tab.

 

I tried adding ms-excel:ofe|u| to my URL but got an Invalid URL error msg. I also tried adding ?Web=1 to the end of the URL but got the same error

 

My URL is generted like so....

https://mydomain.com/:x:/r/sites/SiteName/Shared%20Documents/Sub%20Folder/tester_title.xlsx

 

Any help/suggestions would be much appreciated.

 

Thanks,

Syed

2 ACCEPTED SOLUTIONS

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

If you turn on the Document ID Service in the site collection it should change the link to one that uses the ID for retrieval.  That link will work anywhere you move the document within that site collection.

image.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Thanks @Pstork1,

 

I've asked Admin to check for me.

 

In the meantime, I started looking at the way links are generated in the doclib and played around with the links a little. To my surprise adding the following to the end of my link opened the file in the browser.....

?csf=1&web=1

 

I have no idea what ?csf=1 means but guessing &web=1 means top open in the browser?

 

Anyway, just thought i'd share for reference.

 

Many thanks again.

View solution in original post

9 REPLIES 9
Pstork1
Dual Super User III
Dual Super User III

The url and parameters are different for Excel Online.  Here are the parameters that I think you will need.

 

It will look like this example

https://acmee3.sharepoint.com/sites/FlowDemos/Shared%20Documents/LoopBack_20_21.xlsx?d=wc5e89b4b7f4f...

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Thanks @Pstork1

 

So, to give a little more context, the update item action updates the link column to the file in the doc-lib, in the following format.....

Capture.JPG

once the list item is created. 

 

I went down this route as the file gets moved to a different sub-folder after an approval step. I haven't found a solution to be able to maintain file ID consistency as the file moves to a different folder the ID changes, and thus unable to update the list item with correct link.

 

So, although your suggestion works when i copy the file link from the doclib and add the section - &action=default&mobileredirect=true - to the end of that link, the true link (code) changes once moved to another folder. The only thing that i can see which is consistent is the filename which is why I am using the update item action as above.

 

Interested to know your thoughts on my method and if you have any other suggestions? 

 

 

Pstork1
Dual Super User III
Dual Super User III

If you turn on the Document ID Service in the site collection it should change the link to one that uses the ID for retrieval.  That link will work anywhere you move the document within that site collection.

image.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

thanks @Pstork1

 

I will ask Admin to check that for me as that will help with a lot of other things.

 

I have however found another way to resolve the issue by taking the sourcedoc code from the file link when opening it direct from the doc-lib, and adding that part to the URL along with the piece of code you suggested......

https://mydomain.sharepoint.com/:x:/r/sites/MySite/_layouts/15/Doc.aspx?sourcedoc=%7BF75545D4-5305-4F31-A881-79E25C3F58EF%7D&file= <filename dynamic content> &action=default&mobileredirect=true

 

This seems to be working now.

 

Thanks again. I'll mark this as resolved.

 

Pstork1
Dual Super User III
Dual Super User III

That was my original idea.  The problem is that I couldn't find any way to get the GUID value for Sourcedoc using flow alone.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @Pstork1,

 

Seems i was too quick to think this was resolved. Turns out I mistakenly thought the GUID value for Sourcedoc was specific to the doclib. Obviously this is a unique ID referring to each file. 

 

Any ideas how i could go about getting the GUID value for Sourcedoc? You said its not possible via flow alone?  What else do you think would be necessary?

 

Or perhaps there is a better alternative to using this method to open the file in the browser?

Pstork1
Dual Super User III
Dual Super User III

I was hoping that turning on the docID service would change the link to item to the sourcedoc.  It appears from the tests I did yesterday that it doesn't.  but it may take time for the links to be change, so that still might work.

 

However, I now think there is a way to get the guid for sourcedoc from the link to item in flow.  If you look at the last parameter in the link it will be something like this.

?d=wc5e89b4b7f4f4b36acd66622c891ad44

and the sourcedoc is

?sourcedoc=%7BC5E89B4B-7F4F-4B36-ACD6-6622C891AD44%7D

If you compare the two sections I've put in bold italics you can see they are the same number in a slightly different form.  So you could get the sourcedoc from the link and reformat it to create the new link you need.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Pstork1
Dual Super User III
Dual Super User III

So evidently it is a timing thing.  I just looked at my demo environment again and there is a new property available when I get File properties called the document ID.  This property contains a link to the site's document ID redirect page and the ID of the document.  Using that as the link will redirect you to the file itself.  It should work even if you move the file inside the site collection.  But it took a while after turning on the Doc ID service before the property showed up.  So have your admins turn on Doc ID in a site collection, wait 24 hours and see if that property doesn't show for you also.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Thanks @Pstork1,

 

I've asked Admin to check for me.

 

In the meantime, I started looking at the way links are generated in the doclib and played around with the links a little. To my surprise adding the following to the end of my link opened the file in the browser.....

?csf=1&web=1

 

I have no idea what ?csf=1 means but guessing &web=1 means top open in the browser?

 

Anyway, just thought i'd share for reference.

 

Many thanks again.

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (19,656)