Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is there an easy way to move all the site columns in a particular group (e.g. "PepsiSiteColumns") to another site collection?

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

Out of the box, there is no easy solution. I recently had to move some site columns from development to production and had to resort to some custom PowerShell script. There's also no easy way to copy content types to another environment and/or collection.

In short, it can be done but you'd need to write some custom PowerShell to do it.

share|improve this answer
    
Thanks for replying. We have metalogix for moving or migrating contents but it does not have moving site columns option. I did see content types. oh well, Just finished both of them manually. –  Roxanne May 17 '11 at 23:13
add comment

If you have a requirement to use site columns across site collections, you probably should consider creating a content type hub in order to centrally manage your content types. Even if you do not have the same content types in each site collection, you will probably be able to find a common base content type from which these would derive. This base content type would include the columns that you want to use across the different site collections.

share|improve this answer
    
A Content Type Hub will not copy Columns between Site Collections, only the Columns associated with Content Types –  user9808 Aug 1 '12 at 13:04
    
True - but usually the underlying requirement in this situation is to manage the content types centrally. –  SPDoctor Oct 2 '12 at 18:41
add comment

I had a similar requirement, ended up with a powershell script similar to the following, which should solve the Original Poster's requirement.

Add-PSSnapin Microsoft.SharePoint.PowerShell
$w1 = Get-SPWeb "https://sharepointsite1.com"
$w2 = Get-SPWeb "https://sharepointsite2.com"
foreach ($f1 in $w1.Fields) {
 if ($f1.Group -eq "PepsiSiteColumns") {
  $f2 = $w2.Fields | Where { $_.Id -eq $f1.Id };
  if ($f2 -eq $null) {
   Write-Host("Creating field " + $f1.Title + "...");
   $f2 = $w2.Fields.AddFieldAsXml($f1.SchemaXml);
   $f1.Delete(); # Careful with this one!
  } else {
   Write-Host("Field " + $f1.Title + " already exists. Not taking any action.");
  }
 }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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