Sharepoint REST download returns incomplete content on aspx files and large files
Category
- [x] Bug
Describe the bug
We're using :
/_api/web/GetFileById('<file_guid>')/$value
Or
/_api/web/GetFileByServerRelativeUrl('
Expected behavior
Returned content length should be exactly the same as in file properties form Sharepoint.
Developer environment
REST API
Thanks
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
I can repro this as well...
Microsoft guys, any update on this? This issues is causing to data corruption on migration and backup processes, one of major sharepoint api is buggy. Please take a care
@andrewconnell Hi, is this repository monitored at all by Microsoft ? Thanks
I asked around internally and the guidance I got was to use the Microsoft Graph endpoint or the "download.aspx" URL which supports byte range requests for reliable downloads instead of the /$value.
That said, for site pages, are you expecting to back them up by backing up the *.aspx file? If that's the target scenario you will likely run into issues. We don't currently have an officially supported way of working with site pages using the APIs today.
@JeremyKelley Thanks for the feedback. Few points :
- Graph API doesn't supports downloading attachments from the list items. Also Graph API as far as I know doesn't returns all lists and document libraries when enumerating drives (this is the way to work with document library).
- As part of backup that we provides to our customers we need to backup also aspx files and currently it's an issue.
- In many cases I see downloaded size much larger than size in metadata on PDF, Doc and not only in aspx. How can I use Graph API when I don't know what is real file size ? As metadata size doesn't match real file size ? if It's download less, I can try to ask for additional bytes using Graph API, but when downloaded more ?? Sio bug is not only in download API but also in metadata (as size property is not valid).
- REST API is officially supported API, why not fixing bugs there ? I can understand that for deprecated API but as far as I know it's not deprecated yet. And it's a bug !!! And as I said this bug is not only for aspx files, but it's not consistent. Graph API has many limitations for very long period and it's doesn't seems progressing. So, bottom line REST API is buggy and nobody is fixing those bugs, and Graph API is very limited and can't be used.
Sharepoint team 2 month opened (reproducible) bug here without any care to be taken of. Very sad.
I can verify that this bug still persists today in June 2022. Our customers have OneNote files bigger than 15 GB in size (don't ask why). I've tried Sharepoint REST API v1, REST API v2, Graph v1 onenote, copy.asmx webservice, vti_bin author.dll, bytes range in header .... nothing works. So frustating.