Search Wiki:
Using
Microsoft.TeamFoundation.VersionControl.Client

Sample Code
// query the version control repository for items matching a file specification
// set the folder for the root of your search
String rootFolder = "$/MyProject";
 
// construct the set of item specifications you want to search for
ItemSpec[] itemSpecs = new ItemSpec[] { 
    new ItemSpec(String.Format("{0}/*.sln", rootFolder), RecursionType.Full),
};
 
// make the call to retrieve the matching items
ItemSet[] itemSets = versionControl.GetItems(itemSpecs, 
    VersionSpec.Latest, DeletedState.NonDeleted, ItemType.File, GetItemsOptions.Unsorted);
 
foreach (ItemSet itemSet in itemSets)
{
    // cast the Items property to an IEnumerable so we can run a linq query on it
    IEnumerable<Item> items = (IEnumerable<Item>)itemSet.Items;
 
    // let's sort the results by check-in date
    var sortedItems = from item in items 
                      orderby item.CheckinDate descending 
                      select item;
 
    foreach (Item item in sortedItems)
    {
        Debug.WriteLine(item.ServerItem);
    }
}
Last edited Jul 9 2009 at 4:28 AM  by JimLamb, version 1
Updating...
Page view tracker