1.0 Description:

A custom Powershell cmdlet to add, remove and change the order of the content types in SharePoint 2010 list

2.0 Set-SPListContentTypes

NAME

Set-SPListContentTypes

SYNTAX

Set-SPListContentTypes [-url] <String> [-ListName] <String> [[-ContentTypeToAdd] <List`1>] [[-ContentTypeToRemove] <List`1>] [[-ContentTypeOrder] <List`1>]


Parameters

Parameter

Required

Type

Description

Url

Required

System.String

Specifies the URL of the site collection.

ListName

Required

System.String

Specifies the list name.

ContentTypeToAdd

Optional

System.Collections.Generic.List<T>

Add list of content types to the SharePoint list.

ContentTypeToRemove

Optional

System.Collections.Generic.List<T>

Remove list of content types from the SharePoint list.

ContentTypeOrder

Optional

System.Collections.Generic.List<T>

Change the order of the content types in the list.

Detailed Description

EXAMPLE 1

Set-SPListContentTypes http://sitename/sites/test -ListName "tl" – ContentTypeToAdd @("ct1","ct2") – ContentTypeToRemove @("Content1","Content2") – ContentTypeOrder @("ct2","ct1")

The above cmdlet will

3.0 Register the cmdlet: