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 agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.