How to use PnP to add a content type to tenant gallery

Rene Wagner 161 Reputation points
2022-07-12T20:48:48.02+00:00

Hello,

I am trying to create a PnP PowerShell script to add content types to my tenant, but I want to add the content types at the tenant content type gallery level, NOT at a site level.

I can use the following Add-PnPContentType command

Add-PnPContentType -Name "Test Document Child" -Description "Use for Testing projects" -Group "Testing Content Types" -ParentContentType (Get-PnPContentType -Identity 0x010100F8F6CB8367825D448D19791A73DEB66A)

and it runs successfully. But when I access my tenant content type gallery the type does not show up. I create my connection using my Admin site URL, e.g. https://tenantName-admin.sharepoint.com ... is that the correct URL to use? Anyone know why the content type gets created but it does not appear in the list?

Thanks

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,200 questions
{count} vote

Accepted answer
  1. Koti 181 Reputation points
    2022-07-13T07:15:29.377+00:00

    Hi @Rene Wagner ,

    You can use https://tenantname.sharepoint.com/sites/contentTypeHub url to add content type so. Then you add required column to the content type.

    This will be avaiable in all other site collections.

    sample:

    Connect-PnPOnline https://tenantname.sharepoint.com/sites/contentTypeHub

    Add-PnPContentType -Name "Pnp-Content" -Description "Created using Pnp-PS" -Group "Pnp-PS" -ParentContentType (Get-PnPContentType -Identity 0x0101)

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.