11

I have created an document set with a temporary name but now want to rename it using REST API.

I do not want to create a new document set and move the files to the new location.

Is there any way to accomplish my requirement?

2

1 Answer 1

4

Yes, a Document Set is basically a folder. Here's an example for "Shared Documents" and a folder or doc set named "Toys".

URL:

https://yourServer/sites/training/demoworkflow/_api/web/GetFolderByServerRelativeUrl('Shared Documents/Toys')/ListItemAllFields

Method:

POST

Headers:

{ "accept": "application/json;odata=verbose",
    "content-type": "application/json;odata=verbose",
    "X-HTTP-Method": "MERGE",
    "If-Match":  "*",
    "content-length":___yourBodyLen___,
    "X-RequestDigest": "___yourRequestDigest___"}

Body:

{"__metadata":{"type":"SP.Data.Shared_x0020_DocumentsItem"},
               "Title":"TestToysDocs", "FileLeafRef":"TestToysDocs" }

Replace the ___text___ with your data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.