0
votes

I have create some site columns in my sharepoint page. I tried to add it to my content type create by code but it got exception : the field is deleted or not exist. My question is can I add a field create on a sharepoint page into a content type by code? If yes, how can I do it?

*Note: I know there is a way to add a custome field (create by code) to content-type through.

1

1 Answers

0
votes

If you want to add site column to a content type, we can use PnP powershell to achieve it.

Add-PnPFieldToContentType

Example:

Add-PnPFieldToContentType -Field "Project_Name" -ContentType "Project Document"