I want to create new Content Type which will be child of existing Content Type - Workflow Task (SharePoint 2013) using REST API. So when I create request, I include parent Content Type Id in new Id.
I have tried following code.
const api = '/_api/web/contenttypes';
const requestBody = {
'__metadata': {
'type': 'SP.ContentType',
},
'Description': 'This is content type',
'Name': 'TestContentType',
'Group': 'TestContentTypeGroup',
'Id': {
'__metadata': {
'type': 'SP.ContentTypeId'
},
'StringValue': '0x0108003365C4474CAE8C42BCE396314E88E51F000x010056401AE39A088645AD0597364A428033'
}
};
const requestHeaders = {
'accept': 'application/json;odata=verbose',
'content-type': 'application/json;odata=verbose',
'X-RequestDigest': <digestValue>
};
const requestData = JSON.stringify(requestBody);
var executor = new SP.RequestExecutor(<AppWebUrl>);
executor..executeAsync({
url: '<BaseUrl>' + api,
method: 'POST',
body: requestData,
headers: requestHeaders,
success: res => {
console.log(res);
},
error: error => {
console.log(error);
}
});
It does create new content type TestContentType but it inherits from Item Content Type and it does't have same Id which I provided in request. It randomly generates any id.
Can anyone please help with that?