zhiqin_guo
zhiqin_guo

Reputation: 109

Onedrive business upload API : A file name with spaces becomes +

before upload i will urlencode the filename, so my url is

https://xxx-my.sharepoint.com/_api/v2.0/drive/items/root:/test+test.txt:/content when i upload a file named test test.txt

but this API isn't deal with this.

onedrive api: https://api.onedrive.com/v1.0/drive/items/root:/test+test.txt:/content can run correctly

how can i keep the accurate file name with PHP

Upvotes: 1

Views: 1458

Answers (2)

Arno Inen
Arno Inen

Reputation: 64

Office is slowly turning into Google Drive's retarded cousin. Sharepoint or Onedrive doesn't accept spaces or other characters.

Upvotes: -1

Brad
Brad

Reputation: 4202

+ is a tricky character in so far as being an encoded form of space. I believe it's technically only legal in the query string, and the expected way to encode the space in the path component is using %20. You'll get the same behavior from both consumer and business if you use the percent encoded version, while as you've found out the + encoding only works as you desire for consumer (although whether it should is obviously debatable).

Upvotes: 0

Related Questions