9

I'm using the SharePoint online REST API. Things generally work fine, but I'm failing to figure out how to get information about a file (document) that contains a quote in its name. Here's my REST call:

https://mysite.sharepoint.com/_api/Web/getfilebyserverrelativeurl("/Shared Documents/Roy's quoted doc.txt")

The response I'm getting is '400 Bad Request', with the error being "The expression "Web/getfilebyserverrelativeurl("/Shared Documents/Roy's quoted doc.txt")" is not valid."

I've tried all sorts of tricks with encoding the path (%27 encoding for the quote sign, backslashing the quote, etc.), but failed to figure out the right one.

Is there any kind of encoding I'm not aware of?

13

Try putting extra apostrophe. That is, use Web/getfilebyserverrelativeurl("/Shared Documents/Roy''s quoted doc.txt")

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.