Closed Youssef-El-Garmit closed 4 months ago
i finnaly find how to do it : const contentTypeList = (await list.contentTypes()).filter(x => x.Name === "Item").pop(); list.contentTypes.getById(contentTypeList.Id.StringValue).update({DisplayFormUrl: "", NewFormUrl: "", EditFormUrl : "" });
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
What version of PnPjs library you are using
3.x
Minor Version Number
24
Target environment
SharePoint Framework
Additional environment details
I'm using spfx
Question/Request
Hi, I'm struggling to update a content type, and I'm using this code:
let list = await sp.web.lists.getByTitle('DEV [MANE TEMPLATE] Parents'); const contentTypeList = (await list.contentTypes()).filter(x => x.Name === "Item").pop(); const contentTypWeb = await sp.web.contentTypes.getById(contentTypeList.Id.StringValue); console.log(await contentTypWeb.update({DisplayFormClientSideComponentId:"077f5c4a-37bf-4531-ac24-6369ca0f5f54",DisplayFormClientSideComponentProperties:"",EditFormClientSideComponentId:"077f5c4a-37bf-4531-ac24-6369ca0f5f54",EditFormClientSideComponentProperties:"",NewFormClientSideComponentId:"077f5c4a-37bf-4531-ac24-6369ca0f5f54",NewFormClientSideComponentProperties:""}));
This code calls this endpoint: /_api/web/contentTypes('0x0100A815DFA36C6408439DF4CB0A4F0B6A20'), which doesn't work because I receive:
{ "odata.metadata": "https://manegroup.sharepoint.com/sites/FRISMSharePointGPMSTasksWorkflowTest/_api/$metadata#Edm.Null", "odata.null": true }
Instead, I would like the code to use this endpoint: /_api/web/lists(guid'8e7efc3f-2db9-4a63-89bd-a6fa5b0e1126')/contenttypes('0x0100A815DFA36C6408439DF4CB0A4F0B6A20') from a list, but I couldn't find anything in the documentation.