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); }