public static T Generate <T>()
            where T : PipelineConfiguration, new()
        {
            var self = new T()
            {
                SourceConnection = new ConnectionInfo()
                {
                    CollectionUrl = "http://localhost:8080/tfs/DefaultCollection",
                    ProjectName   = "yourSourceProject",
                    User          = "******",
                    Password      = "******"
                },
                DestinationConnection = new ConnectionInfo()
                {
                    CollectionUrl = "http://localhost:8080/tfs/DefaultCollection",
                    ProjectName   = "yourTargetProject",
                    User          = "******",
                    Password      = "******"
                },
                PipelineStages = new List <string>()
                {
                    "step1", "step2"
                },
                StopPipelineOnFirstError = true,
                TestOnly      = true,
                Logging       = LoggingLevel.Diagnostic,
                ChangeLogFile = "changes.csv",
                LogFile       = "log.txt",
                // let them say
                AreasAndIterationsStage = AreasAndIterationsStageConfiguration.Generate(),
                GlobalListsStage        = GlobalListsStageConfiguration.Generate(),
                WorkItemsStage          = WorkItemsStageConfiguration.Generate()
            };

            return(self);
        }
        public override int Execute(StageConfiguration configuration)
        {
            mapping = (GlobalListsStageConfiguration)configuration;

            var sourceWIStore = sourceConn.Collection.GetService <WorkItemStore>();
            var destWIStore   = destConn.Collection.GetService <WorkItemStore>();

            var updateList = new List <XmlElement>();

            eventSink.ReadingGlobalListsFromSource();

            // get Global Lists from TFS collection
            var sourceGL = sourceWIStore.ExportGlobalLists();

            eventSink.SelectingGlobalLists();

            // read the XML and get only the GLOBALLIST element.
            foreach (XmlElement glElement in sourceGL.GetElementsByTagName("GLOBALLIST"))
            {
                string glName = glElement.Attributes["name"].Value.ToString();

                if (mapping.IsIncluded(glName))
                {
                    eventSink.GlobalListQueuedForUpdate(glName);
                    // queue
                    updateList.Add(glElement);
                } //if
            }     //for list

            eventSink.BuildingGlobalListUpdateMessage();

            XmlDocument updateDoc = new XmlDocument();
            XmlProcessingInstruction _xmlProcessingInstruction;

            _xmlProcessingInstruction = updateDoc.CreateProcessingInstruction("xml", "version='1.0' encoding='utf-8'");
            updateDoc.AppendChild(_xmlProcessingInstruction);
            XmlElement updateRoot = updateDoc.CreateElement("gl", "GLOBALLISTS", "http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/globallists");

            foreach (var glSourceElement in updateList)
            {
                var glUpdateElement = updateDoc.ImportNode(glSourceElement, true);
                updateRoot.AppendChild(glUpdateElement);
            }//for
            updateDoc.AppendChild(updateRoot);

            eventSink.UpdatingGlobalListsOnDestination();

            if (!configuration.TestOnly)
            {
                destWIStore.ImportGlobalLists(updateDoc.InnerXml);
                foreach (var glSourceElement in updateList)
                {
                    string glName = glSourceElement.Attributes["name"].Value.ToString();
                    this.ChangeLog.AddEntry(new GlobalListChangeEntry(glName));
                }//for
            }

            eventSink.GlobalListsUpdated();

            return(saveErrors);
        }
 public override int Prepare(StageConfiguration configuration)
 {
     mapping = (GlobalListsStageConfiguration)configuration;
     return(0);
 }