Enabling content type on multiple SharePoint lists with PowerShell

This scipt enable a content type in all lists (or document libraries) in a site collection. Site collection url is provided by user via the "site" parameter. The script loops all the webs and look for the list where you want to enable the content type. List name is provided by user via the "site" parameter.

In a new project I’m working on I had to create a new Content Type and make it available on all the document libraries in the site collection. I had to choices: browse each document library’s settings page and enable the content type via the UI or let PowerShell do it for me. Since I’m really lazy I chose the scripting way.

A few days ago I published the script on TechNet Gallery,Enabling content type on multiple lists with PowerShell. As you can imagine the script enables a content type on each document library in a site collection. It takes three parameters: site, name and list.

  • Site is the URL of the site collection;
  • Name is the name of the content type;
  • List is the name of the list or document library where you want to enable the content type.

Once the new content type has been enabled the script set it as default by resetting the content types order in the list. All other content types instances will be disabled in each list and you wont be able to select them adding new content in the list. Previously created items will keep the original content type.

The script is based on two posts I found on the web (if you are the author of one of this post, thank you). Here you can find the original posts:

and this is the link to TechNet Gallery:

– Ri.

Posted by Riccardo

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.