Welcome to MSDN Blogs Sign in | Join | Help

Show all pending changes on the Team Foundation server older than a given age

This came up in the forums and Brian responded with an example showing how to list all pending changes.  This is a slightly modified version to print out the changes older than 2 weeks.

    TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(server);

    VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));

 

    TimeSpan cutoffAge = TimeSpan.FromDays(14); // 2 weeks

    DateTime cutoffPoint = DateTime.Now - cutoffAge;

 

    PendingSet[] sets = vcs.GetPendingSets(new String[] { "$/" }, RecursionType.Full);

    Console.WriteLine("{0} total pending set(s)", sets.Length);

    foreach (PendingSet set in sets)

    {

        bool setInfoShown = false;

        foreach (PendingChange pc in set.PendingChanges)

        {

            if (pc.CreationDate < cutoffPoint)

            {

                if (!setInfoShown)

                {

                    setInfoShown = true;

                    Console.WriteLine();

                    Console.WriteLine("Workspace {0};{1} on {2} has {3} total pending change(s)", set.Name, set.OwnerName, set.Computer, set.PendingChanges.Length);

                }

                Console.WriteLine("{0,-20} {1,-10} {2,-16} {3}", pc.FileName, pc.ChangeTypeName, pc.CreationDate, pc.LocalItem);

            }

        }

    }

Published Thursday, December 01, 2005 1:19 PM by jmanning

Comments

# Links to code samples

Saturday, August 12, 2006 10:51 AM by Buck Hodges
I recently had to put together a list of links to code samples.&amp;nbsp; This isn't even close to comprehensive,...

# Контроль версий файлов в TFS

Friday, September 28, 2007 8:12 AM by Dmitry Andreev

Подсистема контроля версий файлов в TFS позволяет работать из командной строки. Находится эта утилита

# Links to code samples

Saturday, September 06, 2008 11:44 AM by Buck Hodges

I recently had to put together a list of links to code samples. This isn't even close to comprehensive,

# James Manning s blog Show all pending changes on the Team Foundation | Cellulite Creams

Anonymous comments are disabled
 
Page view tracker