Geeks With Blogs
Gaurav Bodar - ALM Consultant, TFS specialist ALM, TFS, Agile, Scrum, Sharepoint, IT Service

Most of the people who were using TFS 2008, won’t find the easy way to move SharePoint sites with new level of mappings.

For ex TFS 2008 SharePoint team site would be http://teamserver:80/sites/<projectname>


However when you create new Project in tfs 2010 or 2012 (2013 as well), your SharePoint site would map to tfs collection and team Project site would be sub site in SharePoint

For ex TFS Project site in tfs 2010 would look like http://teamserver:80/sites/<Collectionname>/<Project name>


Problem is when you migrate from TFS 2008 to 2012, you don’t like to have many sites and all new project sites are listed under default collection.

Try to use this power-shell solution to import export SharePoint. You can’t use backup-restore because SharePoint doesn’t allow backup from site and

restored under sub site


Try to follow the below steps as It could save some time. You might want to customize the scripts based on your needs


1. Export all Sites under particular Web application ( To get your tfs 2008 sites exported)

$mysitesurl = <"http://IISSite/sites/*">
$backuppath = <"D:\temp\" >
$webapp = <http://IIS site:80>

Get-SPSite -WebApplication $webapp -Limit ALL | where { $_.Url -like $mysitesurl } | ForEach-Object{ $path = $backuppath + $_.Url.Substring($_.Url.LastIndexOf("/")+1);

Export-SPWeb -Identity $_.Url -Path $path -Verbose }

when I ran the above command my sites were stored with .cmp extension. You can copy those backup to new folder and

use the rename command so that you could create site with project name  


I wrote Rename file extension because writing 175 project name for creating new site wasn’t fun J, feel free to use if you need or

you could manually create file name with your team site name for creating sites.


2. Rename the File extension

Function Rename-FileExtension($path,$oldExtension, $newExtension)


 Get-ChildItem -path $path -Filter $oldExtension |

 Foreach-Object {

   if($_.extension.length -gt 0)


      $baseName = $$ - $_.extension.length)



    { $baseName = $ }

 Rename-Item -Path $_.fullname -newname ($baseName + $newExtension)


} #end function


Rename-FileExtension -path "D:\backup" -oldExtension "*.cmp" -newExtension " "

Now I had filename available with exact team site name. Now creating blank sites with that name under tfs 2010 team site collection.


3. Create New Blank Site


$mysitesurl = "http://<Servername>/sites/Collection site/"

$backuppath = "D:\backup\"


$files = get-childitem $backuppath |

ForEach-object { New-SPWeb ($mysitesurl + $_.Name) -Template STS#0 -Name ( $_.Name) -verbose}

More information on Create site check here   


At last, you could use the import command to Import all TFS 2008 sites content as sub site to your tfs 10 collection site


4. Import the site 

$mysitesurl = "http://<servername>/sites/Collection site/"

$backup = "D:\Backup\"


$files = get-childitem $backup |

ForEach-object { Import-SPWeb ($mysitesurl + $_.Name) -path ($backup + $_.Name) -Force}

This should allow you to change TFS 2008 Team sites to tfs 2010 type, However don’t forget It doesn’t mean you would get all the functionalities of new SharePoint.

It helps you to keep your tfs team sites managed correctly 

Posted on Thursday, August 22, 2013 9:01 AM TFS , team foundation server , sharepoint , team site , tfs site | Back to top

Comments on this post: How to set the sharepoint site level correctly for tfs 2005 or 2008 sites after migrating to tfs 2010, tfs 2012 or tfs 2013

comments powered by Disqus

Copyright © Gaurav Bodar | Powered by: