I am struggling with the creation of a document set via REST API in SharePoint online. The only solution I found doing this was using the old SharePoint 2010 REST interface in the following way:
$http({
method: "POST",
url: url + "/_vti_bin/listdata.svc/" + listTitle,
data: JSON.stringify(docSetOptions),
headers: {
"Accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $('#__REQUESTDIGEST').val(),
"Slug": _spPageContextInfo.siteServerRelativeUrl + "/" + url + docSetOptions.Path + "/" + docSetOptions.Title + "|" + docSetOptions.ContentTypeId,
}
}).success(function (data, status, headers, config) {
logtoconsole("document set created");
}).error(function (data, status, headers, config) {
logtoconsole("document set error");
});
docSetOptions are those:
var folder = new
{
Title = "foo",
Path = "foo",
ContentTypeId = "0x010050D9126DC6276846BF6D869EF2090EAD",
ContentType = "SP.Data.Shared_x0020_DocumentsItem",
};
The id is the id of my custom content type, derived from document set.
Source: http://www.itidea.nl/index.php/create-a-document-set-using-jsom-and-rest/
This works for me, but a regular folder is created. No document set. Does anybody know if this still works in SharePoint Online? The only entries I found were regarding SharePoint 2013.
Update: I ran the same script against my SharePoint 2013 on Premise Server and it works perfectly. Document set is created. Microsoft changed this a few months ago. It used to be possible!
0x0120D520- Gautam Sheth