Click here to Skip to main content
13,506,535 members
Click here to Skip to main content
Add your own
alternative version


2 bookmarked
Posted 16 Feb 2017

noTiFS - TFS Commits Notifications

, 17 Feb 2017
Rate this:
Please Sign up or sign in to vote.
An application which communicates with your TFS server - notifies about changes and shows a quick history


This tool allows the user to get notifications about changes made in the TFS project. It also provides a quick way to see the project's history and changeset.

Useful when developing in teams - the team leader (or code reviewer) gets a notification whenever a change is made.

Also handy for the developers in the project in order to know what other developers are doing or when a CR was done to their code.


For those less familiar with TFS - Team Foundation Server is a source control product developed by Microsoft. It is similar to other popular source controls such as SVN and GIT. Once you set up a server (either at your work environment or at home), you need to connect to it using your preferred method (for instance Visual Studio) and only then can noTiFS connect to it (it uses the current connection to the server).

Using the Code

The code needs references to TFS assemblies (Microsoft.TeamFoundation.Client).

Connects to the server and retrieves the projects in it:

var tpc = new TfsTeamProjectCollection(new Uri(txtUrl.Text));
_versionControl = tpc.GetService<VersionControlServer>();

var projects = _versionControl.GetAllTeamProjects(true);

Fetches the history of the project:

var changes = _versionControl.QueryHistory
(new ItemSpec(_project, RecursionType.Full), 100).ToArray();

Checks if there are new commits (items which are not in the current array):

var commits = GetHistory(path);
var newCommits = commits.Where
(commit => _commits[path].All(c => !c.Equals(commit))).ToList();

_commits[path] = commits.ToArray();

if (first)
    first = false;

foreach (var commit in newCommits)

Opens the history window:

private void btnHistory_Click(object sender, EventArgs e)
        if (string.IsNullOrEmpty(txtTfPath.Text))
            throw new Exception("Enter tf.exe path");

        if (!File.Exists(txtTfPath.Text))
            throw new Exception("TF exe not found - " + txtTfPath.Text);

        var info = new ProcessStartInfo(txtTfPath.Text)
            Arguments = "history /recursive " + _project,
            UseShellExecute = false,
            CreateNoWindow = true

    catch (Exception ex)

Notifies the user of the change - uses NotifyForm:

private void Notify(CommitInfo commit)
            if (InvokeRequired)
                BeginInvoke((Action)(() => Notify(commit)));

            var msg = string.Format
            ("New Commit - {0} : {1}\n{2}\n{3}", commit.Project, commit.Commiter,
             commit.Time, commit.Comment);

            NotifyForm.Show(msg, OnHist);


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Israel Israel
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionMessage Closed Pin
17-Feb-17 15:06
memberSteve Walker17-Feb-17 15:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180417.1 | Last Updated 17 Feb 2017
Article Copyright 2017 by Blondy314
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid