Forum Discussion
SharePoint Online support for # and % in file names
Using REST and the GetFileByServerRelativeUrl method the only file I can access is "test file". If I try and access "test%20file.jpg" without encoding I get the results for "test file.jpg" which makes sense.
However, if I encode the % (so using "test%2520file.jpg") I still get the results for "test file.jpg". No matter what permutation of encoding I use, I cannot access either of the files with % in the name.
Testing this myself now, I am unable to upload any files containing a '%' so I can't run through this exact scenario but I know that all three of those filenames you suggest are unique as long as they're encoded and then decoded. Can I ask where you have the ability to upload a file with a '%' in the name?
Either way, if you are making a call to the endpoint for 'test%2520file' it should absolutely return 'test%20file' and if that is not the case then SharePoint may not be behaving as expected. Maybe some double encoding might be a work around? I'm not sure If SP tries to parse any other forms of encoding when using the REST service.
- Aaron Robertson-HodderNov 14, 2017Copper ContributorYou will only be able to if support for these characters is enabled in your tenant. See the following link for details:
https://blogs.technet.microsoft.com/wbaer/2017/04/06/new-support-for-and-in-sharepoint-online-and-onedrive-for-business/- Charles PritchardNov 14, 2017Copper ContributorOh fantastic thanks, I read somewhere recently the feature had been released. I'll get onto our global admin to enable it as soon as we've verified it's production ready.
I'd love to have a go at replicating the issue; once I can so I'll get back to you after some investigating. This is very relevant to our clients too as we have a lot of cloud migrations that we perform.- Aaron Robertson-HodderDec 07, 2017Copper Contributor
I just stumbled across https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/supporting-and-in-file-and-folder-with-the-resourcepath-api today. There are REST versions of the ...Path methods. The date says it was early November but maybe it didn't hit search when I was originally looking...