private static WorkItemStore GetWorkItemStore(ISourceControlConnectionSettingsSource settings) { TfsConnectionParameters parameters = TfsConnectionHelper.GetTfsConnectionParameters(settings); var teamProjectCollection = new TfsTeamProjectCollection(parameters.TfsCollectionUri, parameters.Credential); teamProjectCollection.EnsureAuthenticated(); var workItemStore = teamProjectCollection.GetService <WorkItemStore>(); return(workItemStore); }
private VersionControlServer GetVersionControl(ISourceControlConnectionSettingsSource settings) { VersionControlServer versionControl = null; TfsConnectionParameters parameters = TfsConnectionHelper.GetTfsConnectionParameters(settings); switch (parameters.SegmentsCount) { case UriTfsProjectCollection: { _teamProjectCollection = new TfsTeamProjectCollection(parameters.TfsCollectionUri, parameters.Credential); _teamProjectCollection.EnsureAuthenticated(); versionControl = _teamProjectCollection.GetService <VersionControlServer>(); _teamProjects = versionControl.GetAllTeamProjects(false); break; } case UriTfsTeamProject: { _teamProjectCollection = new TfsTeamProjectCollection(parameters.TfsCollectionUri, parameters.Credential); _teamProjectCollection.EnsureAuthenticated(); versionControl = _teamProjectCollection.GetService <VersionControlServer>(); _teamProjects = new TeamProject[] { versionControl.GetTeamProject(parameters.TeamProjectName) }; break; } default: throw new Exception("Wrong URI format."); } return(versionControl); }