web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get file conten...
Power Automate
Answered

How to get file content from Shared OneDrive link

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

 

  I want to get file content from Shared OneDrive link as 

 

https://XXXXXXX-my.sharepoint.com/:t:/g/personal/XXXXXXX_XXXXX_onmicrosoft_com/EcLLnlKqL3lDpvzVE5LDPGABtyy9YNrAJT_bGF1MXcnElQ

 

 

The link come from Dataverse Note table that was generated by MS Teams Approvals template. 

 

Supplementary Information: 

KMLAU_MOORE_0-1705481466270.png

 

 

Would you teach me how to parse/resolve above link by power automate for further manipulation ?

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,970 Most Valuable Professional on at

    Hi @KMLAU_MOORE,

     

    You can place the URL in a HTTP action. The response will give you a HTTP Redirect 302 Object moved reply with Headers which contain a link to the actual location and a doc id. You can reuse that doc Id in another HTTP request. I shared this approach earlier in this thread:

    https://powerusers.microsoft.com/t5/Building-Flows/HTTP-request-to-Sharepoint-sharing-link-fails-with-401/m-p/2062356

     

    Below is an example for a OneDrive file

     

    1. The Send an HTTP request uses the URI below

     

     

    _api/web/GetFileById('@{substring(outputs('HTTP')['headers']['Location'], add(indexOf(outputs('HTTP')['headers']['Location'], 'sourcedoc=%7B'), 13), 36)}')

     

     

    2. Also make sure the configure run after setting on that action is configured on the the status has failed

    odfb_getfilebyid.png

     

     

  • KMLAU_MOORE Profile Picture
    on at

    Dear Expiscornovus, 

     

      Thanks for your teaching. However, I tried to place the URL in a HTTP action with configure run after setting on that action is configured on the status has failed.

     

    The output is forbidden (403). 

    And Response Headers did not contain a link to the actual location and a doc id. Would I have anything wrong?  Or Has any other solution advise for?

     

    KMLAU_MOORE_0-1705993430564.png

     

  • Expiscornovus Profile Picture
    33,970 Most Valuable Professional on at

    Hi @KMLAU_MOORE,

     

    Apologies if it wasn't clear. The has failed configure run after setting needs to be applied to the Send an HTTP Request to SharePoint action and not on the HTTP action.

     

    But that might not be the issue. You are getting a 403 instead of a 302. Dou you have permission to view the file? Is it an anyone who has a link is allowed to view the file type of link?

  • KMLAU_MOORE Profile Picture
    on at

    Thanks for your reply.

    Firstly, the follow your instructions add failed configure run after setting needs to the Send an HTTP Request to SharePoint action also.

     

    And I am the file owner. I have permission to view the file because the file located on my OneDrive account for preliminary testing. However, no everyone did not been allowed to view it.

     

    KMLAU_MOORE_0-1705996483999.png

     

     

  • KMLAU_MOORE Profile Picture
    on at

    Dear Expiscornovus, 

     

      Let me talk the whole story to you.  I use MS Teams Approval Template to work for simple reimbursement processing. User will attach their expense quotations to Teams Approval app. Unfortunately, Approval Template place the link to file in the Dataverse Note table. I need to extract the quotations file records to outside to be retained for a period of not less than 7 years. 

     

     

     

  • Expiscornovus Profile Picture
    33,970 Most Valuable Professional on at

    Hi @KMLAU_MOORE,

     

    To be clear, I am using the below type of link in my testing. What type of link are you using?

     

    typeofsharelink.png

     

    Thanks for sharing that information. From you screenshot it looks like you have set the run after setting to both has failed and is successful for both actions. Can you correct that?

     

    The HTTP only needs to run on successful status (please uncheck has failed)

     

    http_runafter.png

     

    The Send an HTTP request action needs to be running on has failed (please uncheck is successful).

     

    hasfailed_sendanhttprequest.png

  • KMLAU_MOORE Profile Picture
    on at

    Thanks Expiscornovus,  thanks your teaching patiently and your great help. 

     

    Unbelievable, I got a progression.  However, still not get the answer. Would you give me more opinions? I have already asked many people to teach me resolve the shared link. 

     

    Regards,

     

     

    Permission status for file

    KMLAU_MOORE_0-1706005798170.png

     

    http action result

    KMLAU_MOORE_1-1706006623270.png

     

    KMLAU_MOORE_2-1706006797931.png

     

     

  • Expiscornovus Profile Picture
    33,970 Most Valuable Professional on at

    Hi @KMLAU_MOORE,

     

    That is strange, your file is directly opening and you are getting a Status Code 200 and the file is directly opening. Which explains why it is not working for you.

     

    I was expecting a Status Code 302 with a Object Move message. That response normally has a Location field in the Outputs Headers with a specific link to the new location. 

     

    http302_response.png

     

    Is there anything specific with the .xslx file you are using in your test?

     

    Have you tried copy/pasting the sharing link manually to test if that works? Would be great to compare it to retrieving it from the Dataverse Note table, to see if there is any difference. 

     

    copy_pastedlink.png

  • KMLAU_MOORE Profile Picture
    on at

    Hi Expiscornovus, 

     

      After checking, the link in Dataverse Note table is same as copy/pasting the sharing link manually. Happy your fully support. 

    As you know, I want to solve the problem of attachment file on Teams Approval Template. 

    And I discovered that attachment file name will be in the title field on the Datavserse Note table. Can use MS graph API to search by filename to solve my problem? 

    (As I know, the attachment file will store in the user's OneDrive/<Approvals  Document>

     

    If yes, would you give me the guidelines to me to copy the attachment file out?

     

    KMLAU_MOORE_0-1706088925458.png

     

     

     

  • Verified answer
    Expiscornovus Profile Picture
    33,970 Most Valuable Professional on at

    Hi @KMLAU_MOORE,

     

    I have done some testing with the Basic Approval template and the Notes table.

     

    Can you try the below approach instead?

     

    1. Extraction of the URI of the persons OneDrive site, based on the notetext attribute value

    concat(split(outputs('Get_a_row_by_ID')?['body/notetext'], '/')[0],'/',split(outputs('Get_a_row_by_ID')?['body/notetext'], '/')[1],'/',split(outputs('Get_a_row_by_ID')?['body/notetext'], '/')[2],'/',split(outputs('Get_a_row_by_ID')?['body/notetext'], '/')[5],'/',split(outputs('Get_a_row_by_ID')?['body/notetext'], '/')[6])

     

    File Path

    Documents/Approvals Document/@{outputs('Get_a_row_by_ID')?['body/subject']}

     

    noteid_returnattachment.png 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard