c#通过编码检查是否有PendingChanges没有签入

using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;

var pendingList = new List<KeyValuePair<string, string>>();
            foreach (var ser in RegisteredTfsConnections.GetProjectCollections())
            {
                var server = RegisteredTfsConnections.GetProjectCollection(new Uri(ser.Uri.ToString()));
                var projects = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(server);
                var versionControl = (VersionControlServer)projects.GetService(typeof(VersionControlServer));
                var userName = versionControl.AuthorizedUser;
                var workspaces = versionControl.QueryWorkspaces(null, userName, System.Net.Dns.GetHostName());
                foreach (var workspace in workspaces)
                {
                    var pendingChanges = workspace.GetPendingChanges();
                    foreach (PendingChange pendingChange in pendingChanges)
                    {
                        var pendingItem = new KeyValuePair<string, string>(server.Name, pendingChange.LocalItem);
                        pendingList.Add(pendingItem);
                        Console.WriteLine("{0}\t{1}", pendingItem.Key, pendingItem.Value);
                    }
                }
            }
            Console.In.ReadLine();

 

posted on 2012-11-28 16:45  空明流光  阅读(675)  评论(2编辑  收藏  举报

导航