cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Access file contents via a url in a list

I have a SharePoint List (List A) and one of the 'columns' contains a link (url) to a document in another list (List B).
I'm trying to construct a flow that does the following. The Flow is triggered when a value in List A is modified (e.g. a status is set to true). I'd like to access the contents of the file in List B, convert it to PDF and save the new file in List B.

There doesn't seem to be an obvious way to do a "Get" to obtain the ID of the file in List B (via it's url) from List A.
I've tried 'Get Attachment Contents' and the flow ran ok, but the output was blank, because (I presume) the Action wasn’t able to get a handle for the source file in List B.
Any ideas?

3 REPLIES 3
Highlighted
Solution Sage
Solution Sage

Re: Access file contents via a url in a list

Hi @Anonymous @

The Url of the document contain the name of the file.

First, we can get the name from the Url in List A, then using the ‘condition’ to get the document from List B.

 I have made a test on my side, please take a try with the following workaround:

The Url which I created in List A is like this: file:///C:/Users/zhongys/Desktop/Daily words.docx

The compose action is to get the Name of the document.

The expression is : last(split(triggerBody()?['Url'],'/'))

1.png2.png3.png

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Anonymous
Not applicable

Re: Access file contents via a url in a list

hI v-zhos-msft ,

Thanks for your reply, it is very much apprecaited. I spent some time experimenting with the teqnique you set out in your response but with no success. Unfortunately the url in the column in List A looks something like this...

"https://xxxxxxxx.sharepoint.com/:w:/s/itmgt/pmo-staxxxs/PT/ArchiHome/EXXvrSR3xfefsfsfe52nVJ7vG18BBEt..."

I'm therefor not able to split off the file name and then compare it to each item in the list to find the item in List B.

What confuses me is that the url is a unique 'path' to the file so why can't that be used to get the contents of the file?

Highlighted
Anonymous
Not applicable

Re: Access file contents via a url in a list

spent a bit more time on this... If I hard code the ID of the document the flow works perfectly. So, the missing bit is how to derive the ID of the document from the url

FLOW_EXAMPLE3.PNG

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (9,067)