Forum Discussion

andres101's avatar
andres101
Copper Contributor
Sep 28, 2020
Solved

Create Content Types programmatically or import massively

Hi,

 

I've been trying to use the Rest API to create Content Types without luck (as it seems there's a bug which Microsoft is not willing to fix): https://github.com/pnp/pnpjs/issues/457

 

Also, there's no documented way to do the same through the Graph API.

 

So, do you guys know any way to create Content Types massively or import them in a similar way it's done through the new Term Store?

 

Thanks!

  • andres101 Try creating content types with PowerShell,

    Add-PnPContentType -Name "<name> " -Description "<description>" -Group "<group name>" -ParentContentType <parent content type (to fetch default columns)>

    Then you can add fields to that specific content type:

    Add-PnPField -DisplayName "<display name>" -InternalName "<internal name>" -Type <field type> -Group "<same group as the content type>"

Resources