1

I want to get content OR download file by GUID. I can work when use APIs below to get ServerRelativeUrl and use which to download file. But I must call three API:

https://your-site/_api/web/lists/getbytitle('document')/items?$top=1&$filter= UniqueId eq 'GUID'

and

https://your-site/_api/web/lists/getbytitle('document')/items/GetById(1)/file

I just want to call an API by GUID.

Hope everyone can help.

1

1 Answer 1

1

If you want to get file using SharePoint API calls only, try using API call like:

<siteUrl>/_api/web/GetFileById('<file unique id>')

Reference: Working with document Libraries based on UniqueID REST API


Additional:

You can also try using URL like this and see if it works for you:

https://contoso.sharepoint.com/sites/SiteName/_layouts/15/download.aspx?UniqueId={F841E2A9-A1E3-4941-A0A1-8A9080ED6756}

Where F841E2A9-A1E3-4941-A0A1-8A9080ED6756 is unique ID of your file.

Reference: SharePoint Online: Download files using JSON Formatting

4
  • Thank you very much, its work for me.
    – Hàn Vũ
    Commented Oct 25, 2023 at 1:35
  • Great, I am glad it worked for you. Commented Oct 25, 2023 at 3:03
  • 1
    Thank you, bro. i did that.
    – Hàn Vũ
    Commented Dec 19, 2023 at 9:05
  • You're welcome! Commented Dec 19, 2023 at 9:06

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.