Welcome to Manicprogrammer Sign in | Join | Help

TFS Event Subscription Tool

On CodePlex a project by Jeff Atwood was started for making it much easier to work with TFS Event Subscriptions. I imagine that you should expect another release out on the product soon. One of the deficiencie is that similar to earlier releases of the Team Foundation Server Administration Tool  it does not support connecting to a server that is on another domain because it uses the default windows authentication credentials for the person running the tool. I have recently added...  a few hours ago to be exact - it's 2:30am Feb 27 GMT -5... I recently added code that uses the same DomainProjectPicker that you are already familiar with in Team Explorer. You know... the one that looks like the following:

 

 

Assuming Jeff accepts all my changes the tool now starts up as does the current release of the Team Foundation Administration Tool with the above server selection dialog. If you have ever wanted to use this standard Team System form it's an easy thing to do. It's especially nice that you can use the control and tell it not utilize the bottom section that shows the listing of team project. The code for doing so is below:

 

/// <summary>
/// Presents the DomainProjectPicker just as in Team Explorer to select the TFS Server and prompts for
/// login information if needed.
/// </summary>
/// <returns>A TeamFoundationServer object representing the chosen and properly authenticated TFS Server</returns>
/// <exception cref="Microsoft.TeamFoundation.TeamFoundationInvalidServerNameException">If the user provides invalid credentials or the user
/// does not select a TFS Server in which to login this exception is thrown</exception>
protected TeamFoundationServer ChooseAppServer()
{
    Cursor.Current = Cursors.Default;
    TeamFoundationServer tfsServer = null;
    DomainProjectPicker dpp = new DomainProjectPicker(DomainProjectPickerMode.None);
    if (dpp.ShowDialog() == DialogResult.OK)
    {
        try
        {
            Cursor.Current = Cursors.WaitCursor;
            TeamFoundationServer tempTfs = new TeamFoundationServer(dpp.SelectedServer.Name, new UICredentialsProvider());

            tempTfs.Authenticate();
            tfsServer = tempTfs;
            Shared.UserDomain = tempTfs.AuthenticatedUserIdentity.Domain;
            Shared.UserName = tempTfs.AuthenticatedUserIdentity.AccountName;
        }
        finally
        {
            Cursor.Current = Cursors.Default;
        }

    }
    else
    {
        throw new Microsoft.TeamFoundation.TeamFoundationInvalidServerNameException("No Team Foundation Server was specified.");
    }

    return tfsServer;

}

 

 

The DomainProjectPickerMode.None is what gives you only the server connection portion versus the full screen that would normally list the team projects and would like the below:

 

 

By utilizing the code to create a TeamFoundationServer instance via the class versus the factory allows for the use of the UICredentialsProvider() which will prompt for user credentials if the server you are connecting to does not use the domain credentials you are signed in under. Thus this will work with Basic Authentication over SSL just as well as when on the same domain.

 

new TeamFoundationServer(dpp.SelectedServer.Name, new UICredentialsProvider());

 

This was the major contributions I made to the project thus far. The rest were some little things like enabling and disabling the Get subscriptions button based on the state of the form so that if you have not chosen a TFS instance or you decide to empty the user textbox the Get Subscriptions button become disabled.

Try it out and throw additional ideas of what should be in the too - such as adding it to Visual Studio as an add-in.

 

 

 

Technorati tags: , ,
Published Tuesday, February 27, 2007 3:44 AM by michaelruminer
Filed under , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Friday, March 02, 2007 10:11 AM by Team System News

# VSTS Links - 03/02/2007

Buck Hodges on Schema for the WorkspaceMapping.xml file. Michael Ruminer on TFS Event Subscription...


Enter the text you see in the image:

Leave a Comment

(required) 
required 
(required)