문제

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?

올바른 솔루션이 없습니다

다른 팁

Microsoft has made some changes to support some of the old special characters that used to be restricted.

Supporting % and # in files and folders with the ResourcePath API

So instead of using GetFolderByServerRelativeUrl you need to use GetFolderByServerRelativePath.

This question/answer is about the same problem (the hash #): SharePoint Online folder with "#" not found

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top