I'm working on a Word add-in with a form for selecting SharePoint Online documents, using the REST API.
At the moment, I was able to download the file directly by the URL following this MSDN article:


However, this downloads the file with the name $value instead of the correct filename. Is it possible to get the actual name through REST?

  • Get any property using:_api/Web/GetFileByServerRelativePath(decodedurl='/sites/site/folder/Test.docx')/Title..
    – Deepmala
    Mar 23, 2018 at 3:24

1 Answer 1


Because when you download the file by the REST API, you just get the stream of the file even though you have downloaded the file.


I suggest you could get the stream of the file by the REST API and save the file to the local with the correct file through the JavaScript code.

There is a similar post:


More reference:

Sending and Receiving Binary Data.

  • Although unwanted, this is what I had to end up doing. I wanted to avoid saving locally so that Word could use the auto-save to cloud feature, but oh well...
    – Camilo
    Apr 2, 2018 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.