Migrate a SharePoint Team Wiki to an Enterprise Wiki

Perhaps someone has also migrated his old SharePoint 2007 Team Wiki to SharePoint 2010 and wants to have the cool features from an Enterprise Wiki.

I searched a while and I think the best way to do this is to migrate with PowerShell. The List Wiki and the Enterprise Wiki are using different fields so there will be no other way I thing but PowerShell or manually.

So the great script for your use. Just adapt the settings for your environment.

 <# PowerShell Script to migrate Team Wikis into Enterprise Wiki Pages #>  
 # Setup Basic sites and pages  
 $webappURL     = "http://sharepoint-uat"  
 $wikiSiteURL  = "$webappURL/sites/serverplatforms"        
 $wikiWebURL    = "$wikiSiteURL/wiki"              
 $pageFolder    = "/Seiten/"  
 $oldWikiWeb   = "$webappURL/sites/serverplatforms"  
 $wikiListName  = "Team Wiki"  
   Write-Host " >> STARTING MIGRATION ..." -foregroundcolor green  
   Write-Host "   1. GETTING SiteColletion: $wikiSiteURL" -foregroundcolor green   
   $wikiSite   = Get-SPSite $wikiSiteURL  
   $psite     = New-Object Microsoft.SharePoint.Publishing.PublishingSite($wikiSite)   
   Write-Host "   2. GETTING ENTERPRISE WIKI WEB: $wikiWebURL" -foregroundcolor green   
   $web     = Get-SPWeb $wikiWebURL  
   $pweb     = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)  
   $pages     = $pweb.GetPublishingPages($pweb)  
   Write-Host "   3. GETTING WIKI PAGE LAYOUT" -foregroundcolor green   
   $ctype     = $web.AvailableContentTypes | ? { $_.Name -eq "Enterprise Wiki Page"}  
   $layouts   = $psite.GetPageLayouts($ctype, $true)  
   $layout   = $layouts[0]  
   # OLD WIKI  
   Write-Host "   4. GETTING OLD WIKI" -foregroundcolor green   
   $wikiWeb  = Get-SPWeb $oldWikiWeb  
   $wiki     = $wikiWeb.Lists[$wikiListName]  
   Write-Host "   5. LOOPING THROUGH THE WIKI LIST ITEMS" -foregroundcolor green   
   $i = 0;  
   foreach ($oldItem in $wiki.Items) {  
     Write-Host ""  
     # Create a new page in the enterprise wiki  
     $name     = $oldItem["ows_BaseName"]  
     if ($name -eq "home") {  
     Write-Host "     >> MIGRATING ITEM: $name" -foregroundcolor yellow    
     $strDestURL = $wikiWebURL + $pageFolder + $name + ".aspx"  
     Write-Host "     >> NEW URL IS: $strDestURL" -foregroundcolor yellow  
     $page     = $pages.Add($strDestURL, $layout)  
     Write-Host "     >> CHANGING PAGE PROPERTIES" -foregroundcolor yellow  
     $item       = $page.ListItem      
     $author     = $oldItem["ows_Created_x0020_By"]  
     $userID     = $web.EnsureUser($author).ID  
     $item["Title"]   = $name  
     $item["Editor"] = $userID  
     $item["Author"] = $userID      
     # Replace the links in the new content  
     $content   = $oldItem["ows_WikiField"]  
     $newContent = $content -replace "/Team%20Wiki/", "/wiki/Seiten/"    
     # Add new content to the page  
     $item["ows_PublishingPageContent"] = $newContent  
   Write-Host "   6. MIGRATION FINISHED !!" -foregroundcolor green   
   Write-Host "     >> MIGRATED $i SITES." -foregroundcolor yellow  
 catch [System.Exception] {  
   Write-Host "Error while migration Wiki List...`n" -foregroundcolor red  


Anonymous said…
is there a way that we can migrate enterprise wiki site to team site in sharepoint 2010.
Baris Bikmaz said…
Personally I would copy the enterprise wiki site as subsubsite under the team site. But you modify the script above by looping through the pages library of the enterprise wiki and adding the content to an item in the team wiki list. The modifications should be easy.

Popular posts from this blog

SharePoint Web Folders - Create a Desktop Shortcut to a SharePoint library on Windows XP with and without SSL

Ways to redirect http requests in SharePoint

Open SharePoint 2010/2013 Display, Edit, New Forms in Modal Dialogs