Sharepoint online now allows # and % characters in filenames:


Is it possible to retrieve a file like that using the sharepoint api?

Let's assume i have a file called test%file.pdf.

When making a request such as:

Request ->


I receive a response:

Response ->

  "error": {
    "code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
    "message": {
      "lang": "en-US",
      "value": "The query string \"serverRelativeUrl\" is missing or invalid."

Is there a specific way to escape this or is this not supported in the sharepoint api?

Thanks! Ruel Loehr

1 Answer 1


I haven’t tried it, but it could be because of two reasons.

  1. REST API are still not compatible with special characters in file name.
  2. You might need to encode your file path.

You can give a try to second option. Where you encode the Path of your file. In JavaScript we have two methods encodeURI and encodeURIComponent. You have to use encodeURIComponent function in order to encode the document path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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