public IList <DeliveryPipeline> GetPipelines() { IList <DeliveryPipeline> pipelines = new List <DeliveryPipeline>(); Uri collectionUri = new Uri(Uri); ProjectCollection = new TfsTeamProjectCollection(collectionUri); BuildServer = ProjectCollection.GetService <IBuildServer>(); CommonStructureService = ProjectCollection.GetService <ICommonStructureService>(); Registration = ProjectCollection.GetService <IRegistration>(); VersionControlServer = ProjectCollection.GetService <VersionControlServer>(); ClientHyperlinkService = ProjectCollection.GetService <TswaClientHyperlinkService>(); Name = ProjectCollection.CatalogNode.Resource.DisplayName; if (BuildServer.BuildServerVersion.ToString() == "v3") { TfsVersion = 2010; } else { TfsVersion = 2012; } foreach (ProjectInfo project in CommonStructureService.ListProjects()) { foreach (IBuildDefinition definition in BuildServer.QueryBuildDefinitions(project.Name)) { if (definition.Process.ServerPath.Contains("BuildProcessTemplates/PowerDelivery")) { IDictionary <string, object> processParams = WorkflowHelpers.DeserializeProcessParameters(definition.ProcessParameters); if (processParams.ContainsKey("PowerShellScriptPath")) { string scriptPath = processParams["PowerShellScriptPath"] as string; string scriptName = System.IO.Path.GetFileNameWithoutExtension(scriptPath.Substring(scriptPath.LastIndexOf("/"))); string environmentName = definition.Name.Substring(definition.Name.LastIndexOf(" - ") + 3); DeliveryPipeline pipeline = pipelines.FirstOrDefault(p => p.ScriptName == scriptName); if (pipeline == null) { pipeline = new DeliveryPipeline(this, project, scriptName); pipelines.Add(pipeline); } PipelineEnvironment environment = new PipelineEnvironment(pipeline, environmentName, definition); pipeline.Environments.Add(environment); } } } } return(pipelines); }