1

so I have one heavily customized SharePoint Document Library with lots of extra fields. I'm wondering if anyone has figured out an easy way to lift those fields into a Content Type while preserving the underlying data, that which I can use those custom fields elsewhere (and use that new content type). This been attempted at all? This is for SharePoint 2010.

0

You can user PowerShell command to add the existing list column to content type in the document library. Run SharePoint 2010 Management Shell as administrator, then copy the PowerShell command below to change the relevant site URL, library name, column name, content type name and paste it:

$web = get-spweb "http://spsitename/" 
$list = $web.Lists["DocumentLibraryName"] 
$field=$list.Fields["columnname"]
$fieldlink=New-Object Microsoft.SharePoint.SPFieldLink $field
foreach($ctype in $list.ContentTypes)
{
  if($ctype.Name -eq "contenttypename")
  { 
     $ctype.FieldLinks.Add($fieldlink)
     $ctype.Update()
     $list.Update()
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.