11,686 questions
Here are few steps how to do it:
- Use the
POST
method and the endpoint_api/web/folders
to create a folder in the library. You need to specify theServerRelativeUrl
of the folder in the request body. For example, if you want to create a folder namedTest
in theDocuments
library, the request body would be:
{
"__metadata": {
"type": "SP.Folder"
},
"ServerRelativeUrl": "/Documents/Test"
}
- Use the
GET
method and the endpoint_api/web/GetFolderByServerRelativeUrl('Folder Name')/ListItemAllFields
to get the folder’s list item properties. You need to replaceFolder Name
with the actual folder name. For example, if you want to get the properties of theTest
folder, the endpoint would be:
_api/web/GetFolderByServerRelativeUrl('Test')/ListItemAllFields
- Use the
POST
method and the endpoint_api/web/GetFolderByServerRelativeUrl('Folder Name')/ListItemAllFields
to update the folder’s list item properties. You need to specify the__metadata
and the properties you want to update in the request body. You also need to use theMERGE
method and theIf-Match
header to avoid conflicts. For example, if you want to update theTitle
and theDescription
properties of theTest
folder, the request body and headers would be:
{
"__metadata": {
"type": "SP.Data.DocumentsItem"
},
"Title": "Test Folder",
"Description": "This is a test folder"
}
X-HTTP-Method: MERGE
If-Match: *