Search code examples
restsharepointpostmansharepoint-2019

How to create a folder with % character on SharePoint 2019 using rest calls via postman?


I want to create a folder with % character on SharePoint 2019 and I am using the below call:

POST http://<site>/_api/web/folders

{
  "__metadata": {
    "type": "SP.Folder"
  },
  "ServerRelativeUrl": "/SP 2019/Folder%"
}

But this is creating a Folder%25 instead of Folder%.

If I change the character in the JSON to #, it creates a folder with '#' character.


Solution

  • This does the job.

    POST http://<site>/_api/web/folders/AddUsingPath(decodedurl='Path')
    

    It will create a folder with % character. It was introduced for SP Online but also works with SP 2019.

    The issue i am running into is the api returns 400 Bad Request in two cases: a) The folder already exists. b) The URL is malformed.

    I need to distinguish between the two.

    You may take a look at this Microsoft's page for further refrence.