Adding a content type

Aug 30, 2012 at 5:58 PM

I added some more code for handling the item's content type, if needed.

Add this within $metadataManifest.Columns.Column | ForEach-Object {

#content type 


if($_.Type -eq "ContentType"){

 $columnName = $_.Name

 Write-Host "Setting value on column"$columnName "..." -ForegroundColor Blue

$_.Values.Value | ForEach-Object {

$contentType = $docLibrary.ContentTypes[$_]

$spItem[$columnName] = $contentType.Id

Write-Host "Content type set to"$_





and add something like this to your manifest

<Column name="ContentTypeId" type="ContentType">


<Value>Content Type Name Here</Value>





Sep 3, 2012 at 3:52 PM

This is useful, thanks.