Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 580
  • Last Modified:

SharePoint 2010: Is it possible to replace content type from existin libraries?

Hello. I have multiple document libraries with custom content type (content type hub). I would like to replace existing content type with my fancy new content type.  Is it possible to create ps1/c# code that would do this? Should I expect problems? I guess SharePoint may not allow my code to remove existing content type.
2 Solutions
Jamie McAllister MVPArchitectCommented:
In this thread I posted some code to change content types; http://social.msdn.microsoft.com/Forums/sharepoint/en-US/e61f920c-b9ba-44a9-8502-3243621bcdc8/adding-a-content-type-document-to-manyall-libraries-in-a-site?forum=sharepointgenerallegacy

This is managed code rather than powershell, but it can be adapted.
You can have two content types assigned to a list.  You will not be able to remove the original content type of that list if there are any list items that are using that content type.
You can switch a list items content type via the list item properties, or you can also do this via code / PoSH script
tolppaAuthor Commented:

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now