question

RamakrishnanVenkatesan-9784 avatar image
0 Votes"
RamakrishnanVenkatesan-9784 asked RamakrishnanVenkatesan-9784 answered

Upload File to SharePoint through REST API

Hello,

I am uploading ".xlsx " file into SharePoint online using REST API /_api/Web/GetFolderByServerRelativeUrl('-------')/files/add,

My upload is successful, but noticed after uploading file, it contains some additional comments as per below in the top of file, due to that, I am unable to process file .

Please advise.

Content-Type: application/octet-stream;
name=<....,XLSD>
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="filename"; filename="filename"

office-sharepoint-onlinesharepoint-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RamakrishnanVenkatesan-9784 avatar image
0 Votes"
RamakrishnanVenkatesan-9784 answered

Yes, This has been resolved. Thank you.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered RaytheonXie-MSFT commented

Hi @RamakrishnanVenkatesan-9784 ,
Per my test,I uploaded a file successful and correctly with following api:

 _api/Web/GetFolderByServerRelativeUrl('/sites/abc/FolderTest/Test')/Files/add(url='rename.xlsx',overwrite=true)')

We can set the file name after '/Files/add'. Since the error might caused setting filename by headers.


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.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RamakrishnanVenkatesan-9784 ,
I am checking to see how things are going there on this issue.

0 Votes 0 ·

Hi @RamakrishnanVenkatesan-9784 ,
I am checking to see if the problem has been resolved.

0 Votes 0 ·