For SharePoint, when we want our third party Java app to access the files from within document libraries, we currently grab files using HTTP get request.

But if the file is too large, it won't work.

Is there a way to get a file's size by URI with a single rest call?

  • 2
    something like /_api/web/lists/getByTitle('Document Library')/Files?$select=Size ? Commented Nov 9, 2016 at 18:54

4 Answers 4


You can use below rest api to get file size without downloading file...


You will get one node with below name which will return file size....

<d:vti_x005f_filesize m:type="Edm.Int32">1003</d:vti_x005f_filesize>

The Files endpoint might be of use:

/_api/web/lists/getByTitle('Document Library')/Files?$select=Size

When I ran it against an arbitrary library, it indicated a lot of 0 file sizes, so ymmv.

You can call an endpoint like Siddharth shows. In the results of the call I've indicated, there is an endpoint to call for the specific file. It will look something like:


So you could call the initial Files endpoint I referenced, then depending on what you are doing, call the individual file endpoint for further information

  • Does that work for a single file? Please advise. Commented Nov 9, 2016 at 23:03
  • added some more information Commented Nov 10, 2016 at 14:26

This example should work:

${site url}/_api/lists/getbytitle('${Title Name}')/items?$select=File/Length&$expand=File

I can get data from Document library.

Note: I'm using the SharePoint online site, I'm not sure if it would work on the old version.


You can get the size of the file from the HTTP headers too.


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.