Create, Retrieve Or Delete Site Content Type On SharePoint Using PnP PowerShell

Updated: Mar 29, 2019

In this post, you will learn, how we can create, retrieve and delete the site content types on SharePoint sites, using PnP PowerShell. The Client Side Object Model is used internally for these operations. The update operation is not available for the content types.


You need to have PowerShell 3.0, available on a Windows machine. You need to install or import PnP PowerShell packages. You can download the installers or view more documentation on the official site. The installers are available here.

The following operations will be compatible with SharePoint 2013 on-premise or Office 365 versions. 

Connect To Site: Connect to the site, using the snippet, given below. The PnP PowerShell code, given below, helps in getting the current context of the site, using the Client Side Object Model (CSOM).

# Get Current Context Site (Root)

$siteurl = ""

Connect-SPOnline -Url $siteurl  

$ctx = Get-SPOContext  

Once connected, you can carry out any of the operations mentioned below, based on the requirement.

Create Site Content Type:

The content types can be added to the site collections by setting the context, using the site URL. PnP CSOM PowerShell can be used to complete the operation.

Add-SPOContentType command is used to create the site content types on SharePoint sites. The required parameters to create the new site content type are name, description and group. The new values can be passed as the parameters. In my example, I have created new site content called "PnPContentType". The default parent content type will be the item.

The following command snippet helps to create the new content type.

function AddContentType()


 Add-SPOContentType -Name "PnPContentType" -Description "PnP Content Type" -Group "PnPContentTypeGroup"