Inheritance: BaseTeamFoundationServer, INetworkServer
Example #1
0
        public void FixtureSetUp()
        {
            tfsUrl = Environment.GetEnvironmentVariable("TFS_URL");
            if (String.IsNullOrEmpty(tfsUrl))
                {
                    Console.WriteLine("Warning: Environment variable TFS_URL not set.");
                    Console.WriteLine("					Some tests cannot be executed without TFS_URL.");
                    return;
                }

            string username = Environment.GetEnvironmentVariable("TFS_USERNAME");
            if (String.IsNullOrEmpty(username))
                {
                    Console.WriteLine("Warning: No TFS user credentials specified.");
                    return;
                }

            credentials = new NetworkCredential(username,
                                                                                    Environment.GetEnvironmentVariable("TFS_PASSWORD"),
                                                                                    Environment.GetEnvironmentVariable("TFS_DOMAIN"));

            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl)) return;
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);
            versionControlServer = (VersionControlServer) tfs.GetService(typeof(VersionControlServer));

            WorkingFolder[] folders = new WorkingFolder[1];
            string serverItem = String.Format("$/{0}", Environment.GetEnvironmentVariable("TFS_PROJECT"));
            folders[0] = new WorkingFolder(serverItem, Environment.CurrentDirectory);

            workspace = versionControlServer.CreateWorkspace("UpdateWorkspaceInfoCache_Workspace",
                                                                                Environment.GetEnvironmentVariable("TFS_USERNAME"),
                                                                                "My Comment", folders, Environment.MachineName);
        }
Example #2
0
        public override void Connect(string serverUri, string remotePath, string localPath, int fromChangeset, string tfsUsername, string tfsPassword, string tfsDomain)
        {
            this._serverUri = serverUri;
            this._remotePath = remotePath;
            this._localPath = localPath;
            this._startingChangeset = fromChangeset;

            try
            {
                NetworkCredential tfsCredential = new NetworkCredential(tfsUsername, tfsPassword, tfsDomain);
                this._teamFoundationServer = new Microsoft.TeamFoundation.Client.TeamFoundationServer(this._serverUri, tfsCredential);
                this._versionControlServer = (VersionControlServer)this._teamFoundationServer.GetService(typeof(VersionControlServer));
            }
            catch (Exception ex)
            {
                throw new Exception("Error connecting to TFS", ex);
            }

            //clear hooked eventhandlers
            BeginChangeSet = null;
            EndChangeSet = null;
            FileAdded = null;
            FileEdited = null;
            FileDeleted = null;
            FileUndeleted = null;
            FileBranched = null;
            FileRenamed = null;
            FolderAdded = null;
            FolderDeleted = null;
            FolderUndeleted= null;
            FolderBranched = null;
            FolderRenamed = null;
            ChangeSetsFound = null;
        }
Example #3
0
        public TFS(string servername, string domain, string username, string password)
        {
            if (string.IsNullOrEmpty(servername))
            {
                throw new ArgumentException("Parameter named:servername cannot be null or empty.");
            }

            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentException("Parameter named:username cannot be null or empty.");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentException("Parameter named:password cannot be null or empty.");
            }

            try
            {
                var tfsConfigurationServer = new TfsConfigurationServer(new Uri(servername),
                                                                        new NetworkCredential(username, password, domain));
                store = (WorkItemStore) tfsConfigurationServer.GetService(typeof (WorkItemStore));
            }
            catch (Exception)
            {
                var tfsServer = new TeamFoundationServer(servername, new NetworkCredential(username, password, domain));
                store = (WorkItemStore) tfsServer.GetService(typeof (WorkItemStore));
            }
        }
Example #4
0
        public List<string> GetBuilds()
        {
            try
            {

                server = new TeamFoundationServer(CurrentProject.DomainUri);
                server.Authenticate();
                IBuildServer buildStore = (IBuildServer)server.GetService(typeof(IBuildServer));

                IBuildDetail[] buildList = buildStore.QueryBuilds(CurrentProject.ProjectName, "Daily Build");

                List<string> builds = new List<string>();

                foreach (IBuildDetail bd in buildList)
                {
                    builds.Add(bd.BuildNumber);
                }

                builds.Reverse();

                return builds;
            }
            catch
            {
                return new List<string>();
            }
        }
Example #5
0
        public static VSTSMonitor GetMonitor(TeamFoundationServer server, string stateFilePath, string projectPath, int port)
        {
            VSTSMonitor Monitor = null;

            try
            {

                lock (SyncLock)
                {
                    if (Monitors.ContainsKey(projectPath))
                        return Monitors[projectPath];

                    Monitor = new VSTSMonitor(server, stateFilePath, projectPath, port);
                    Monitors.Add(projectPath, Monitor);
                }

            }
            catch (System.Exception ex)
            {
                ThoughtWorks.CruiseControl.Core.Util.Log.Error(ex);
                throw;
            }

            return Monitor;
        }
Example #6
0
        public override void Connect(string serverUri, string remotePath, string localPath, int fromChangeset, string tfsUsername, string tfsPassword, string tfsDomain)
        {
            this._serverUri         = serverUri;
            this._remotePath        = remotePath;
            this._localPath         = localPath;
            this._startingChangeset = fromChangeset;

            try
            {
                NetworkCredential tfsCredential = new NetworkCredential(tfsUsername, tfsPassword, tfsDomain);
                this._teamFoundationServer = new Microsoft.TeamFoundation.Client.TeamFoundationServer(this._serverUri, tfsCredential);
                this._versionControlServer = (VersionControlServer)this._teamFoundationServer.GetService(typeof(VersionControlServer));
            }
            catch (Exception ex)
            {
                throw new Exception("Error connecting to TFS", ex);
            }

            //clear hooked eventhandlers
            BeginChangeSet  = null;
            EndChangeSet    = null;
            FileAdded       = null;
            FileEdited      = null;
            FileDeleted     = null;
            FileUndeleted   = null;
            FileBranched    = null;
            FileRenamed     = null;
            FolderAdded     = null;
            FolderDeleted   = null;
            FolderUndeleted = null;
            FolderBranched  = null;
            FolderRenamed   = null;
            ChangeSetsFound = null;
        }
 public void Authentication1()
 {
     // need TFS_ envvars for this test
     if (String.IsNullOrEmpty(tfsUrl)) return;
     TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);
     Assert.IsFalse(tfs.HasAuthenticated);
 }
Example #8
0
        public TFS(string servername, string domain, string username, string password)
        {
            if (string.IsNullOrEmpty(servername))
            {
                throw new ArgumentException("Parameter named:servername cannot be null or empty.");
            }

            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentException("Parameter named:username cannot be null or empty.");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentException("Parameter named:password cannot be null or empty.");
            }
            //ICredentialsProvider provider = new UICredentialsProvider();
            //tfsServer = TeamFoundationServerFactory.GetServer(serverName, provider);
            //if (!tfsServer.HasAuthenticated)
            //    tfsServer.Authenticate();
            try
            {
                var tfsConfigurationServer = new TfsConfigurationServer(new Uri(servername),
                                                                        new NetworkCredential(username, password, domain));
                store = (WorkItemStore) tfsConfigurationServer.GetService(typeof (WorkItemStore));
            }
            catch (Exception)
            {
                var tfsServer = new TeamFoundationServer(servername, new NetworkCredential(username, password, domain));
                store = (WorkItemStore) tfsServer.GetService(typeof (WorkItemStore));
            }
        }
        /// <summary>
        /// Tries the TFS mode.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns>the number of checkedout files</returns>
        internal static int TryTFSMode(System.IO.FileInfo input)
        {
            try
            {
                var tfs = new TeamFoundationServer(Properties.Settings.Default.TFSServer, new NetworkCredential(Properties.Settings.Default.TFSLogin, Properties.Settings.Default.TFSPassword));
                var version = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
                var workspace = version.GetWorkspace(Properties.Settings.Default.TFSWorkspace, version.AuthorizedUser);
                int ans = workspace.PendEdit(input.FullName);
                return ans;
            }
            catch (Exception)
            {
                Console.WriteLine(
                    string.Format(
@"
/!\The file {0} is read only
please make sure the TFS app settings are OK

Stack trace:

",
input.FullName));
                throw;
            }
        }
Example #10
0
        public void NameProperty()
        {
            string url = "http://example.org:8080/";
            TeamFoundationServer tfs = new TeamFoundationServer(url);

            Assert.AreEqual("http://example.org:8080/", tfs.Name);
        }
Example #11
0
        public void FixtureSetUp()
        {
            tfsUrl = Environment.GetEnvironmentVariable("TFS_URL");
            if (String.IsNullOrEmpty(tfsUrl))
                {
                    Console.WriteLine("Warning: Environment variable TFS_URL not set.");
                    Console.WriteLine("					Some tests cannot be executed without TFS_URL.");
                    return;
                }

            string username = Environment.GetEnvironmentVariable("TFS_USERNAME");
            if (String.IsNullOrEmpty(username))
                {
                    Console.WriteLine("Warning: No TFS user credentials specified.");
                    return;
                }

            credentials = new NetworkCredential(username,
                                                                                    Environment.GetEnvironmentVariable("TFS_PASSWORD"),
                                                                                    Environment.GetEnvironmentVariable("TFS_DOMAIN"));

            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl)) return;
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);
            versionControlServer = (VersionControlServer) tfs.GetService(typeof(VersionControlServer));

            workspace = versionControlServer.CreateWorkspace("WorkspaceTest",
                                                                            Environment.GetEnvironmentVariable("TFS_USERNAME"));
        }
Example #12
0
 public BuildFetcher(String serverAddress, String projectName, ICredentials credentials)
 {
     this.projectName = projectName;
     tfsServer = new TeamFoundationServer(serverAddress, credentials);
     tfsServer.Authenticate();
     buildServer = (IBuildServer) tfsServer.GetService(typeof (IBuildServer));
 }
        public static void MyClassInitialize(TestContext testContext)
        {
            server = new TeamFoundationServer(TFS_SERVER, CredentialCache.DefaultNetworkCredentials);
            server.Authenticate();

            if (!server.HasAuthenticated)
                throw new InvalidOperationException("Not authenticated");
        }
Example #14
0
 public VSTSMonitor(TeamFoundationServer server, string stateFilePath, string projectPath, int port)
 {
     this.Server = server;
     this.StateFilePath = stateFilePath;
     this.ProjectPath = projectPath;
     this.Port = port;
     this.State = this.RetrieveState();
 }
        public void GetService_VersionControlServer()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl)) return;
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);

            VersionControlServer vcs = (VersionControlServer) tfs.GetService(typeof(VersionControlServer));
            Assert.IsNotNull(vcs);
        }
 private void pickServerButton_Click( object sender, EventArgs e )
 {
     DomainProjectPicker dlg = new DomainProjectPicker( DomainProjectPickerMode.None );
     if( dlg.ShowDialog() == DialogResult.OK )
     {
         server = dlg.SelectedServer;
         Send( TeamServerNameChanged );
     }
 }
Example #17
0
        //internal event FileTransferEventHandler Uploading;
        public VersionControlServer(TeamFoundationServer teamFoundationServer)
        {
            ICredentials credentials = teamFoundationServer.Credentials;
            this.teamFoundationServer = teamFoundationServer;
            this.uri = teamFoundationServer.Uri;
            this.repository = new Repository(this, uri, credentials);

            if (credentials != null)
                this.authenticatedUser = credentials.GetCredential(uri, "").UserName;
        }
        public static TeamFoundationServer GetServer(string url, ICredentials credentials)
        {
            TeamFoundationServer tfs;
            if (tfInstances.TryGetValue(url, out tfs))
                return tfs;

            tfs = new TeamFoundationServer(url, credentials);
            tfInstances.Add(url, tfs);
            return tfs;
        }
Example #19
0
        public void Authentication1()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl))
            {
                return;
            }
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);

            Assert.IsFalse(tfs.HasAuthenticated);
        }
 public ChooseProjectsDialog(TeamFoundationServer server)
 {
     collectionStore = new ListStore(collectionName, collectionItem);
     projectsStore = new TreeStore(isProjectSelected, projectName, projectItem);
     BuildGui();
     if (server.ProjectCollections == null)
         SelectedProjects = new List<ProjectInfo>();
     else
         SelectedProjects = new List<ProjectInfo>(server.ProjectCollections.SelectMany(pc => pc.Projects));
     LoadData(server);
 }
Example #21
0
 private void UpdateServer()
 {
     if (string.IsNullOrEmpty(Url))
     {
         server = null;
     }
     else
     {
         server = new TeamFoundationServer(Url, new UICredentialsProvider());
         server.EnsureAuthenticated();
     }
 }
        private void BuildStoreWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            TeamFoundationServer server = new TeamFoundationServer(_teamFoundationServerUri, CredentialCache.DefaultCredentials);
            server.EnsureAuthenticated();

            while (!this.CancellationPending) {
                BuildStore store = (BuildStore)server.GetService(typeof(BuildStore));
                BuildData[] builds = store.GetListOfBuilds(_teamProjectName, _teamBuildTypeName);
                this.ReportProgress(0, builds);
                Thread.Sleep(30000);
            }
        }
        public void GetService_CommonStructureService()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl))
            {
                return;
            }
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);

            ICommonStructureService css = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));

            Assert.IsNotNull(css);
        }
        static public TeamFoundationServer GetServer(string url, ICredentials credentials)
        {
            TeamFoundationServer tfs;

            if (tfInstances.TryGetValue(url, out tfs))
            {
                return(tfs);
            }

            tfs = new TeamFoundationServer(url, credentials);
            tfInstances.Add(url, tfs);
            return(tfs);
        }
        public static BaseTeamFoundationServer Create(XElement element, string password, bool isPasswordSavedInXml)
        {
            var type = element.Attribute("Type");

            if (type == null || (ServerType)Convert.ToInt32(type.Value) == ServerType.TFS)
            {
                return(TeamFoundationServer.FromLocalXml(element, password, isPasswordSavedInXml));
            }
            else
            {
                return(VisualStudioOnlineTFS.FromLocalXml(element, password, isPasswordSavedInXml));
            }
        }
Example #26
0
 private bool TryCredentials(string url, string username, string password)
 {
     var tfsClient = new TeamFoundationServer(url, new NetworkCredential(username, password));
     try
     {
         tfsClient.Authenticate();
         return true;
     }
     catch (TeamFoundationServerUnauthorizedException ex)
     {
         Console.WriteLine(ex.ToString());
         return false;
     }
 }
Example #27
0
        public void NamePropertyWithCredentials()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl))
            {
                return;
            }
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);

            // for some reason Name property works differently when you pass in credentials
            Uri uri = new Uri(tfsUrl);

            Assert.AreEqual(uri.Host, tfs.Name);
        }
        public void GetProject()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl)) return;
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);

            ICommonStructureService css = (ICommonStructureService) tfs.GetService(typeof(ICommonStructureService));
            ProjectInfo p1 = css.GetProjectFromName(Environment.GetEnvironmentVariable("TFS_PROJECT"));
            ProjectInfo p2 = css.GetProject(p1.Uri);

            Assert.IsNotNull(p2.Name);
            Assert.IsNotNull(p2.Status);
            Assert.IsNotNull(p2.Uri);
        }
        public void GetProjectFromName()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl))
            {
                return;
            }
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);

            ICommonStructureService css   = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));
            ProjectInfo             pinfo = css.GetProjectFromName(Environment.GetEnvironmentVariable("TFS_PROJECT"));

            Assert.IsNotNull(pinfo.Name);
            Assert.IsNotNull(pinfo.Status);
            Assert.IsNotNull(pinfo.Uri);
        }
Example #30
0
        public WorkItemFetcher(String serverAddress, String projectName, ICredentials credentials,
                               Dictionary<String, String> configuration)
        {
            String configValue = "";
            WORK_REMAINING_FIELD = (configuration.TryGetValue("tfswi-remaining-field", out configValue))
                                       ? configValue
                                       : WORK_REMAINING_FIELD;
            ESTIMATED_EFFORT_FIELD = (configuration.TryGetValue("tfswi-estimated-field", out configValue))
                                         ? configValue
                                         : ESTIMATED_EFFORT_FIELD;

            this.projectName = projectName;

            tfsServer = new TeamFoundationServer(serverAddress, credentials);
            tfsServer.Authenticate();

            workItemStore = tfsServer.GetService(typeof (WorkItemStore)) as WorkItemStore;
        }
 public static TeamFoundationServer FromLocalXml(XElement element, string password, bool isPasswordSavedInXml)
 {
     try
     {
         var server = new TeamFoundationServer(new Uri(element.Attribute("Url").Value),
                                               element.Attribute("Name").Value,
                                               element.Attribute("Domain").Value,
                                               element.Attribute("UserName").Value,
                                               password,
                                               isPasswordSavedInXml);
         server.ProjectCollections = element.Elements("ProjectCollection").Select(x => ProjectCollection.FromLocalXml(server, x)).ToList();
         return server;
     }
     catch
     {
         return null;
     }
 }
 public static TeamFoundationServer FromLocalXml(XElement element, string password, bool isPasswordSavedInXml)
 {
     try
     {
         var server = new TeamFoundationServer(new Uri(element.Attribute("Url").Value),
                                               element.Attribute("Name").Value,
                                               element.Attribute("Domain").Value,
                                               element.Attribute("UserName").Value,
                                               password,
                                               isPasswordSavedInXml);
         server.ProjectCollections = element.Elements("ProjectCollection").Select(x => ProjectCollection.FromLocalXml(server, x)).ToList();
         return(server);
     }
     catch
     {
         return(null);
     }
 }
        public void ListProjects()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl))
            {
                return;
            }
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);

            ICommonStructureService css = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));

            ProjectInfo[] projects = css.ListProjects();

            foreach (ProjectInfo pinfo in projects)
            {
                Assert.IsNotNull(pinfo.Name);
            }
        }
Example #34
0
        public static Workspace GetWorkspace(string path)
        {
            try
            {
                // First try the cached worksapces
                foreach (Workspace workspace in Workspaces)
                {
                    if (workspace.IsLocalPathMapped(path))
                    {
                        return workspace;
                    }
                }
            }
            catch
            {
            }

            // Otherwise try to create a new workspace
            try
            {
                // Get workspace info for the desired file
                Workstation local = Workstation.Current;
                if (local != null)
                {
                    WorkspaceInfo workspaceInfo = local.GetLocalWorkspaceInfo(path);
                    if (workspaceInfo != null)
                    {
                        // TODO: This only uses the local users credentials
                        // (we can either consider passing in credentials or
                        // also trying to use the build host - like VS - to
                        // obtain them)
                        TeamFoundationServer server = new TeamFoundationServer(workspaceInfo.ServerUri.ToString());
                        Workspace workspace = workspaceInfo.GetWorkspace(server);
                        Workspaces.Add(workspace);
                        return workspace;
                    }
                }
            }
            catch
            {
            }

            return null;
        }
Example #35
0
        public bool Connect()
        {
            try
            {
                //
                //Trace.Write(WindowsIdentity.GetCurrent().Name);

                server = new TeamFoundationServer(ServerName, Credentials);
                store = server.GetService(typeof(WorkItemStore)) as WorkItemStore;
                project = store.Projects[ProjectName];

                //TODO: Validar conexão
                return true;
            }
            catch (Exception xa)
            {
                throw xa;
            }
        }
Example #36
0
        // Crappy
        // http://www.codeproject.com/Questions/499216/ReadingplusaplusdocumentplusfromplusTFSplusserverp
        public static void CrappyKeepTrack()
        {
            Uri uri = new Uri("http://corfoundation:8080/tfs/COR-DEV-Produktion/");

            using (Microsoft.TeamFoundation.Client.TeamFoundationServer tfs = Microsoft.TeamFoundation.Client.TeamFoundationServerFactory.GetServer(uri))
            {
                Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore wit = (Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore)tfs.GetService(typeof(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore));

                Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemCollection result = wit.Query("SELECT * FROM WorkItems");
                foreach (Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem wi in result)
                {
                    foreach (Microsoft.TeamFoundation.WorkItemTracking.Client.Attachment attachment in wi.Attachments)
                    {
                        //do something
                        Console.WriteLine(attachment.Name);
                    } // Next attachment
                }     // Next wi
            }         // End Using tfs
        }             // End Sub CrappyKeepTrack
Example #37
0
        public void Workspace_Get()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl)) return;
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);
            VersionControlServer vcs = (VersionControlServer) tfs.GetService(typeof(VersionControlServer));

            WorkingFolder[] folders = new WorkingFolder[1];
            string serverItem = String.Format("$/{0}", Environment.GetEnvironmentVariable("TFS_PROJECT"));
            folders[0] = new WorkingFolder(serverItem, Environment.CurrentDirectory);

            Workspace w1 = vcs.CreateWorkspace("CreateDelete1_Workspace",
                                                                                 Environment.GetEnvironmentVariable("TFS_USERNAME"),
                                                                                 "My Comment", folders, Environment.MachineName);

            Workspace w2 = vcs.GetWorkspace("CreateDelete1_Workspace");
            Assert.AreEqual("My Comment", w2.Comment);

            w1.Delete();
        }
        public void GetProjectProperties()
        {
            // need TFS_ envvars for this test
            if (String.IsNullOrEmpty(tfsUrl))
            {
                return;
            }
            TeamFoundationServer tfs = new TeamFoundationServer(tfsUrl, credentials);

            ICommonStructureService css = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));
            ProjectInfo             p1  = css.GetProjectFromName(Environment.GetEnvironmentVariable("TFS_PROJECT"));

            string projectName = "";
            string state       = "";
            int    templateId  = 0;

            ProjectProperty[] properties = null;

            css.GetProjectProperties(p1.Uri, out projectName, out state, out templateId, out properties);
            Assert.IsNotNull(projectName);
        }
        /// <summary>
        ///   Create initial connection to the TFS 2008 Build Server.
        /// </summary>
        public void Connect()
        {
            TeamFoundationServer tfs = new TeamFoundationServer(TfsUrl);

            IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));

            buildQueue = buildServer.CreateQueuedBuildsView(TeamProject);

            // We are only interested in builds when they are finished or as they are in progress
            buildQueue.StatusFilter = QueueStatus.Completed | QueueStatus.InProgress;

            // Hook up our build queue listener.
            buildQueue.StatusChanged += new StatusChangedEventHandler(buildQueue_StatusChanged);

            try
            {
                buildQueue.Connect();
            }
            catch (Exception ex)
            {
            }
        }
        protected IEnumerable<MSChangeset> QueryAllChangesetsFromRevision(int revisionId)
        {
            var tfsClient = new TeamFoundationServer(repositoryUrl, credentials);
            tfsClient.Authenticate();

            var vcs = (VersionControlServer) tfsClient.GetService(typeof (VersionControlServer));

            var version = VersionSpec.Latest;
            var versionTo = VersionSpec.Latest;
            var versionFrom = new ChangesetVersionSpec(revisionId);

            const int deletionId = 0;
            const string user = null;
            IEnumerable changesets = vcs.QueryHistory(repositoryPath, version, deletionId, RecursionType.Full, user,
                                                      versionFrom, versionTo, int.MaxValue, true, false);

            var retvalue = new List<MSChangeset>();
            foreach (object item in changesets)
                retvalue.Add(item as MSChangeset);

            return retvalue;
        }
        static void Main(string[] args)
        {
            string projectName = args[0];
            TeamFoundationServer tfs = new TeamFoundationServer(TFSSERVER);
            VersionControlServer versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
            PendingSet[] sets = versionControl.GetPendingSets(new String[] { "$/Projects/" + projectName }, RecursionType.Full);

            Console.WriteLine(versionControl.AuthenticatedUser + " pending changes for " + projectName + ":");
            int total = 0;
            foreach (PendingSet set in sets)
            {
                if (set.Type == PendingSetType.Workspace && set.OwnerName == versionControl.AuthenticatedUser)
                {
                    foreach (PendingChange pc in set.PendingChanges)
                    {
                        Console.WriteLine(pc.ServerItem);
                        total++;
                    }
                }
            }
            Console.WriteLine(total.ToString() + " total changes.");
        }
Example #42
0
        public override bool Execute()
        {
            try
            {
                TeamFoundationServer server = new TeamFoundationServer(tfsUrl,
                                                                       CredentialCache.DefaultNetworkCredentials);

                IGroupSecurityService gss = (IGroupSecurityService)server.GetService(typeof(IGroupSecurityService));

                Identity ident = gss.ReadIdentity(SearchFactor.AccountName, WindowsAccountName, QueryMembership.None);

                MailAddress = ident.MailAddress;
                DisplayName = ident.DisplayName;

                return true;

            }
            catch (Exception ex)
            {
                Log.LogErrorFromException(ex, true);
                return false;
            }
        }
Example #43
0
 public CommonStructureService(TeamFoundationServer teamFoundationServer)
 {
     this.Url         = String.Format("{0}/{1}", teamFoundationServer.Uri, "services/v1.0/CommonStructureService.asmx");
     this.Credentials = teamFoundationServer.Credentials;
 }
Example #44
0
 public Linking(TeamFoundationServer teamFoundationServer)
 {
     this.Url         = String.Format("{0}/{1}", teamFoundationServer.Uri, "WorkItemTracking/v1.0/Integration.asmx");
     this.Credentials = teamFoundationServer.Credentials;
 }
 public GroupSecurityService(TeamFoundationServer teamFoundationServer)
 {
     this.Url         = String.Format("{0}/{1}", teamFoundationServer.Uri, "Services/v1.0/GroupSecurityService.asmx");
     this.Credentials = teamFoundationServer.Credentials;
 }
Example #46
0
 public Registration(TeamFoundationServer teamFoundationServer)
 {
     this.Url         = String.Format("{0}/{1}", teamFoundationServer.Uri, "services/v1.0/registration.asmx");
     this.Credentials = teamFoundationServer.Credentials;
 }