Wild card is in textBox1.Text
using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Framework;
using Microsoft.TeamFoundation.VersionControl.Client;
using System.Net;
private void btnGo_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
NetworkCredential cred = new NetworkCredential("domain\\userid", "password");
//TeamFoundationServer tfs = new TeamFoundationServer("http://tfsserver:8080/TFS/collection", cred);
//tfs.EnsureAuthenticated();
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("http://tfsserver:8080/TFS/collection"), cred);
//tfs.EnsureAuthenticated();
VersionControlServer vcServer = tpc.GetService<VersionControlServer>();
// List all of the .xaml files.
ItemSet items = vcServer.GetItems("$/" + textBox1.Text, RecursionType.Full);
foreach (Item item in items.Items)
{
//Console.Write(item.ItemType.ToString());
//Console.Write(": ");
//Console.WriteLine(item.ServerItem.ToString());
VersionControlLabel[] itemLabels = vcServer.QueryLabels(null, null, null, false, item.ServerItem, new ChangesetVersionSpec(item.ChangesetId));
foreach (VersionControlLabel label in itemLabels)
{
foreach (Item labelItem in label.Items)
{
if (labelItem.ItemId == item.ItemId && labelItem.ChangesetId == item.ChangesetId)
{
// <Found it>
listBox1.Items.Add(item.ItemType.ToString() + ": " + item.ServerItem.ToString() + " checked in:" + item.CheckinDate.ToString() + " label:" + label.Name + " " + label.Comment);
break;
}
}
}
}
}
}
No comments:
Post a Comment