Not abe to create a folder in Sharepoint Site

Madhu Sudan Singh 61 Reputation points
2021-07-08T06:56:11.853+00:00

Hello,

I am trying to create a folder on my Sharepoint site using Postman. But I am not able to create it. Below is my endpoint

https://<spname>.sharepoint.com/sites/SalesforceFiles/_api/web/folders
I am using the POST method and passing the below headers

Authorization:Bearer <MyAccessToken>
Accept:application/json;odata=verbose
Content-Type:application/json;odata=verbose
X-RequestDigest:<FormDigestValue>

I am posting the below body to the endpoint.

{
"__metadata": {
"type": "SP.Folder"
},
"ServerRelativeUrl": "https://<spname>.sharepoint.com/sites/SalesforceFiles/_api/web/GetFolderByServerRelativeUrl('/sites/SalesforceFiles/Shared Documents/<NewFolderNameToBeCreated>')"
}

113101-capture.png

113036-capture1.png

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,214 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,593 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,571 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 30,991 Reputation points Microsoft Vendor
    2021-07-09T06:14:28.547+00:00

    Hi @Madhu Sudan Singh ,
    The wrong ServerRelativeUrl may cause the error.
    It's unnecessary to add "/_api/web/GetFolderByServerRelativeUrl" in ServerRelativeUrl.
    Take the following code as sample:

    {  
    "__metadata": {  
    "type": "SP.Folder"  
    },  
    "ServerRelativeUrl": "https://<spname>.sharepoint.com/sites/SalesforceFiles/Shared Documents/<NewFolderNameToBeCreated>"  
    }  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful