Technology Toolbox

Your technology Sherpa for the Microsoft platform

Jeremy Jameson - Founder and Principal

Search

Search

Upgrading TFS 2005/2008 Project Sites to TFS 2010, Part 2 - Team Wiki

Note
This post originally appeared on my MSDN blog:

Since I no longer work for Microsoft, I have copied it here in case that blog ever goes away.

In part 1 of this series, I showed how you can add new Team Foundation Server (TFS) 2010 dashboard functionality to project sites originally created in TFS 2008 (or TFS 2005).

Another feature that you might want to add to upgraded project sites is a "Team Wiki" library. Wikis provide a great way to quickly share information about various aspects of your project on the site.

Note that wiki libraries are not a feature of TFS, but are inherently available in Windows SharePoint Services (and therefore Microsoft Office SharePoint Server (MOSS) 2007). Consequently, you might very well be leveraging wikis already on your TFS project sites.

If you haven't already added a wiki library, you can quickly create one using out-of-the-box SharePoint functionality.

However, what if you want to add a wiki library to a number of project sites all at once?

If you are using SharePoint Server 2010 (or SharePoint Foundation), then you can easily use PowerShell to add a wiki library:

# Adds a "Wiki" library to a SharePoint site

function AddWikiLibrary(
    [Microsoft.SharePoint.SPweb] $web,
    $libraryName,
    $libraryDescription)
{
    Write-Debug "Adding wiki library ($libraryName) to site ($($web.Url))..."
                    
    $listId = $web.Lists.Add(
        $name,
        $description,
        [Microsoft.SharePoint.SPListTemplateType]::WebPageLibrary)
    
    $wikiLibrary = $web.Lists[$listId]
    
    $null = [Microsoft.SharePoint.Utilities.SPUtility]::AddDefaultWikiContent(
        $wikiLibrary)
}

$name = "Team Wiki"

$description = "Share knowledge for a Team Project by adding or editing" `
    + " content in this wiki"

$DebugPreference = "SilentlyContinue"
$web = Get-SPWeb "http://cyclops/sites/AdventureWorks"

$DebugPreference = "Continue"
AddWikiLibrary $web $name $description

Note that in SharePoint, you create a new list (or library) using the SPListCollection.Add method. Also note that the template corresponding to Wiki Page Library is actually SPListTemplateType.WebPageLibrary, and you can use the SPUtility.AddDefaultWikiContent method to create the two default pages that are automatically added when you create a wiki library through the SharePoint site.

Lastly, as I demonstrated in the earlier post, by using PowerShell you can easily add a wiki library to a number of project sites at once:

$sitesToUpgrade =
    @(
        "http://cyclops/sites/AdventureWorks",
        "http://cyclops/sites/Demo",
        "http://cyclops/sites/Toolbox"
    )

$sitesToUpgrade |
    ForEach-Object {
        $DebugPreference = "SilentlyContinue"
        $web = Get-SPWeb $_

        $DebugPreference = "Continue"
        AddWikiLibrary $web $name $description
        $web.Dispose()
    }

Comments

  1. # re: Upgrading TFS 2005/2008 Project Sites to TFS 2010, Part 2 - Team Wiki

    August 23, 2011 2:23 AM
    Ed Price - MSFT

    Great article!

Add Comment

Optional, but recommended (especially if you have a Gravatar). Note that your email address will not appear with your comment.
If URL is specified, it will be included as a link with your name.

To prevent spam from being submitted, please select the following fruit: Apple

Apple
Pear
Grapes
Strawberry
Watermelon
Cherries
 
Please add 2 and 2 and type the answer here: