1

I am using SPFx webpart on SP2016 and able to create a list with custom content type,below is code sample. But I am not able to get any end point to remove default Item content Type. I want my custom content type should be the default one.

  public addContentTypeToList(listTitle: string, contentTypeId: string): Promise<ISPBaseResponse> {
    if (!SPUtility.isStringNullOrEmpty(contentTypeId)) {
        try {
            return this.spQueryPOST({
                body: JSON.stringify({
                    "contentTypeId": contentTypeId
                }),
                url: 

`${this.WebUrl}/_api/web/lists/getByTitle('${listTitle}')//ContentTypes/AddAvailableContentType`
            }).then((response) => {
                return response;
            });
        } catch (error) {
            console.log(error);
        }
    }
}

Thanks in advance for your time and any help.

Regards,

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.