Documents uploaded to a SharePoint Online library using the REST API can no longer be opened.

Copper Contributor

We have documents (Word, Excel, PDF, png, jpg) that were uploaded to a SharePoint Online document library last month using the REST API from an SPFx web part.  These documents could be opened in the browser or downloaded from the document library.  

 

Yesterday (1/17) we noticed that all of those documents (regardless of type) now show a file size of 15 bytes.  When downloaded and examined, their contents is the following text: [object Object].

 

This is not happening with documents that were uploaded using the SPO GUI.  Those documents have a normal file size and can be opened.

 

Was there a change to SharePoint online in the last week that would render documents uploaded using REST to be modified/corrupted?

 

Here are more details on the SPFx web part and REST endpoint that were used:

  • SPFx version 1.16.0
  • example endpoint URL: 

 

https://<tenant>.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('FacilityDocuments/Acton')/files/add(url='test.xlsx',overwrite=true)?$expand=ListItemAllFields

 

  • using the web part context spHttpClient.post 

 

  const request = {
    body: file
  };  
  const response: SPHttpClientResponse = await spHttpClient.post(
    endpoint,
    SPHttpClient.configurations.v1,
    request
  );​

 

1 Reply
Does this issue have anything to do with Sharepoint Rest API V1 being "legacy"?