0

A file with the following name exists in OneDrive browser. > sample%file name%.pdf

When the above file is downloaded using the following request, an error is returned.

Request:

/_api/web/GetFolderByServerRelativeUrl('%2Fpersonal%2F{my endpoint}%2FDocuments%2F9355')/files('sample%25file%20name%25.pdf')/$value

Response:

HTTP/1.1 404 Not Found
...

cb
<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>-2147024894, System.IO.FileNotFoundException</m:code><m:message xml:lang="e
2b
n-US">File Not Found.</m:message></m:error>
0

Is there a SharePoint REST API limitation wherein file with "%" in its name cannot be downloaded?

0
~, #, %, & , *, {, }, \, :, <, >, ?, /, |, “

Above special character is not allowed for files/folder.. you need to replace these characters for create folder or files. Reference

You have to change the file name as you are using one drive. SharePoint Library also won't allow you to upload files having above mentioned characters.

enter image description here

1
  • I was able to add a file with "%" character. Please refer to the screenshot in the updated question. This was added by renaming an existing file. – Vina Vinas Oct 17 '19 at 4:27
0

Based on the following reference, "%" and "#" can now be used as name for folders and files.

https://developer.microsoft.com/en-us/office/blogs/upcoming-changes-to-sharepoint-and-onedrive-for-business-apis-to-support-and-in-file-names/

However, there are still issues when using String-based URL APIs. I believe that GetFolderByServerRelativeUrl is a String-based URL API.

When the following API is used, file with "%" (even "#") can be downloaded.

/_api/web/GetFileByServerRelativePath(DecodedUrl=@f)/$value?@f='%2Fpersonal%2F{my endpoint}%2FDocuments%2F9355%2Fsample%25file%20name%25.pdf'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.