Unable to create/rename files with special charact

2019-04-13 00:55发布

问题:

I have an issue while creating / renaming files in OneDrive for Business(Admin) through rest client(PostMan).

Can you guys point me where i can find the tutorial or any documentation that states any specific requirements / restrictions for creating / renaming a file.

Please find the below details of the request.

URL : https://graph.microsoft.com/v1.0/cloudfuze.co/users/{user_id}/drive/items/{parent_id}/children/{file_name}/content

Ex File Name : (test).jpg

Headers :

{
    Authorization:Bearer XXXXXXXXXXXXXXXX,
    Accept:application/json,
    Content-Type:application/json
}

回答1:

You can use the following notation to create files with parenthesis in name: https://graph.microsoft.com/v1.0/users/{user_id}/drive/items/{parent_id}/children('{file_name}')/content

For example: https://graph.microsoft.com/v1.0/me/drive/root/children('text(a).abc')/content



回答2:

Seems its some kind of bug. The only workaround I found is to upload a file with random name, then rename it using PATCH. Here's the article about restricted characters in filename: https://support.microsoft.com/en-us/kb/3125202