I am making a REST request to SharePoint for breaking the role inheritance for a folder.
It's working fine when a folder does not have any special character in it's name.
But when I add special charter(s) to a folder name, my request for breakroleinheritance
is failing and I am getting below error from the web service.
"error":{"code":"-1, Microsoft.SharePoint.Client.ResourceNotFoundException","message":{"lang":"en-US","value":"Cannot find resource for the request SP.RequestContext.current/web/GetFolderByServerRelativeUrl('/foldertop/subfolder/2020/Oklahoma/20-4152 test permission for parts2020%23%40%26')/ListItemAllFields/."}}}
For example: 20-4152 test permission for parts2020#@& this is my folder name and after doing URL ending it becomes 20-4152%20test%20permission%20for%20parts2020%23%40%26.
Below is the full endpoint along with relative URL for my folder,
Please know that if I remove the special characters #@&
then same request is working fine.
https://mysharepoint.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('/foldertop/subfolder/2020/Oklahoma/20-4152%20test%20permission%20for%20 parts2020%23%40%26')/ListItemAllFields/breakroleinheritance(true)
Does this mean that the SharePoint REST API request does not support special characters?
encodeURIComponent
sharepoint.stackexchange.com/questions/167125/…