Add site column in existing content type.
Hi Team,
We are using Site script to provision site. I wanted to add a new column to the existing content type "Document" how can we do it ?
Thanks & Regards, Pavan.
You can use below steps:-
- First create a site column using "createSiteColumn" Verb.
- Once site column is created Add this to existing content type using "createContentType" verb. This will add the newly created column to the existing Document content type.
- Once its added to the "Document" content type, add the content type to list using "createSPList" verb. Here is the sample site script.
{ "$schema": "schema.json", "actions" : [ { "verb": "createSiteColumn", "fieldType": "Text", "internalName": "DocumentDescription", "displayName": "Document Description", "isRequired": false }, { "verb": "createContentType", "name": "Document", "description": "Existing Content Type", "parentName": "Item", "hidden": false, "subactions": [ { "verb": "addSiteColumn", "internalName": "DocumentDescription" } ] }, { "verb": "createSPList", "listName": "Documents", "templateType": 101, "subactions": [ { "verb": "addContentType", "name": "Document" } ] } ], "version": 1 } Once the site script is created you can apply the changes to existing site script using "Set-SPOSitescript" command and then update the site design using "Set-SPOSiteDesign" PS command. Once both the site script and site design are updated you can then apply the site design to exisiting site using "Invoke-SPOSiteDesign" PS command.
Hope this helps.
Hi @iamguptarishi,
Thanks for the reply, i tried this one but got the below error(but column gets added to the content type)

Then i tried adding the site column manually (OOTB) and got the below error.

After analysis found the if we select "Update all content types inheriting from this type?" to "Yes" we will get the above error.

I am posting another question to microsoft as OOTB works this way.
Do you have enough permissions to update the content type?
Closing due no response on the permission ask.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues