I am using MS graph API to retrieve folder contents and graphs from SharePoint online, using URLs like [...]/drive/root:/folder1/folder2:/. The folder and document names are of course URL encoded.

It seems to work fine for all allowable characters in folder and document names except for # which just returns a 404 error every time.

Edit 20 Nov

It seems the problem only occurs if the # is immediately preceded by an &. For example, create a folder called a#&b and you can fetch this by URL encoding it as ...:/a%23%26b: - everything works no problem. But if you create a folder called a&#b you cannot fetch it by url encoding it as ...:/a%26%23b:

So it seems this is just an obscure bug in MS graph (or maybe even in whatever SharePoint API it sits on top of). Since the sequence &# is used in HTML, I'd guess they're trying to detect where the caller has mistakenly used HTML encoding and recover from it.

This isn't a real use case for my customer but just something I stumbled upon while trying to test it would work with all possible filenames.

1 Answer 1


I tested this issue as below:

  1. Created a folder with special character #

enter image description here

  1. Retrieve this folder

enter image description here

  1. Encode this special character (%23)

enter image description here


  • Hmm thanks let me try it again, maybe I did something stupid
    – Andy
    Nov 19, 2020 at 8:20
  • I've discovered it only happens with the sequence &# - see my edit to the original post above. Thanks again for making me re-investigate :)
    – Andy
    Nov 20, 2020 at 11:20

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.