GetFile with Id instead of Relative Url in Rest API

asked 2020-09-22T01:42:25.54+00:00
developer sp1 461 Reputation points

I know we can get file by relative url like this:

/_api/web/getFileByServerRelativeUrl('/sites/Test/Documents/Doc1.docx')

But now I want to get with Id like this:

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

I don't know how to get this file unique id can anyone help me please ?

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,344 questions
No comments
{count} votes

Accepted answer
  1. answered 2020-09-22T07:44:06.93+00:00
    Jerryzy 10,296 Reputation points

    Hi @developer sp1 ,

    You can get the file guid using rest api like this:

    /_api/web/lists/getbytitle('Documents')/Items/GetById(44)/file

    26387-snipaste-2020-09-22-15-41-08.png


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments

0 additional answers

Sort by: Most helpful