//public static IEnumerable<List> Get_DocumentLibraries(ClientContext ctx, Web web) //{ // var alllists = web.Lists; // IEnumerable<List> doclibs = ctx.LoadQuery(alllists.Where // (list => list.BaseType == BaseType.DocumentLibrary) // ); // ctx.ExecuteQuery(); // return doclibs; //} private XlHlp.XlLocation AddSection_Libraries(XlHlp.XlLocation insertAt, ClientContext ctx, Web web) { long startTicks = XlHlp.DisplayInWatchWindow(insertAt); if (insertAt.OrientVertical) { XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Libraries", web.Title); } else { XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Libraries", web.Title, orientation: XlOrientation.xlUpward); insertAt.IncrementColumns(); } IEnumerable <List> doclibs = VNC.SP.Helper.GetDocumentLibraries(ctx, web); insertAt.MarkStart(XlHlp.MarkType.GroupTable); insertAt = DisplayListOf_Libraries(insertAt, doclibs, false, "OneLevel"); insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tblLibraries_{0}", web.Title)); insertAt.Group(insertAt.OrientVertical, hide: true); insertAt.EndSectionAndSetNextLocation(insertAt.OrientVertical); XlHlp.DisplayInWatchWindow(insertAt, startTicks, "End"); return(insertAt); }
//private static IEnumerable<List> Get_Lists(ClientContext ctx, Web web) //{ // var alllists = web.Lists; // IEnumerable<List> lists = ctx.LoadQuery(alllists.Where // (list => list.BaseType == BaseType.GenericList) // ); // ctx.ExecuteQuery(); // return lists; //} private XlHlp.XlLocation AddSection_Lists(XlHlp.XlLocation insertAt, ClientContext ctx, Web web) { XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt); if (insertAt.OrientVertical) { XlHlp.AddTitledInfo(insertAt.AddRow(), "Lists", web.Title); } else { XlHlp.AddTitledInfo(insertAt.AddRow(), "Lists", web.Title, orientation: XlOrientation.xlUpward); insertAt.IncrementColumns(); } IEnumerable <List> lists = VNCSP.Helper.GetLists(ctx, web); insertAt.MarkStart(XlHlp.MarkType.GroupTable); insertAt = DisplayListOf_Lists(insertAt, lists, false, "OneLevel"); insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tblLists_{0}", web.Title)); insertAt.Group(insertAt.OrientVertical, hide: true); insertAt.EndSectionAndSetNextLocation(insertAt.OrientVertical); XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End"); return(insertAt); }
private void CreateWS_Web_Info(ClientContext ctx, string sectionsToDisplay, bool orientVertical) { XlHlp.DisplayInWatchWindow(string.Format("{0}", System.Reflection.MethodInfo.GetCurrentMethod().Name)); var web = ctx.Web; ctx.Load(web); ctx.ExecuteQuery(); string sheetName = XlHlp.SafeSheetName(string.Format("{0}{1}", "SPWeb>", web.Title)); Worksheet ws = XlHlp.NewWorksheet(sheetName, beforeSheetName: "FIRST"); XlHlp.XlLocation insertAt = new XlHlp.XlLocation(ws, row: 2, column: 1, orientVertical: GetDisplayOrientation()); if (insertAt.OrientVertical) { XlHlp.AddContentToCell(insertAt.AddRowX(), "Web Info"); insertAt.IncrementRows(); } else { XlHlp.AddContentToCell(insertAt.AddRowX(), "Web Info"); insertAt.DecrementRows(); // AddRow bumped it. insertAt.IncrementColumns(); } if (sectionsToDisplay.Contains("WebInfo")) { insertAt = AddSection_WebInfo(insertAt, ctx, web).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("Libraries")) { insertAt = AddSection_Libraries(insertAt, ctx, web).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("Lists")) { insertAt = AddSection_Lists(insertAt, ctx, web).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("SiteGroups")) { insertAt = AddSection_SiteGroups(insertAt, ctx, web).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("SiteColumns")) { insertAt = AddSection_SiteColumns(insertAt, ctx, web).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("ContentTypes")) { insertAt = AddSection_ContentTypes(insertAt, ctx, web).IncrementPosition(insertAt.OrientVertical); } }
internal static XlHlp.XlLocation ProcessAddSectionCommand_BuildServer( XlHlp.XlLocation insertAt, IBuildServer buildServer, TeamProject teamProject, string sectionTitle, RequestHandlers.ProcessAddHeaderCommand addHeaderCommand, ProcessAddBodyCommand_BS addBodyCommand, string tablePrefix) { long startTicks = XlHlp.DisplayInWatchWindow(insertAt); try { // Save the location of the title so we can update later after have traversed all items. Range rngTitle = insertAt.GetCurrentRange(); if (insertAt.OrientVertical) { XlHlp.AddSectionInfo(insertAt.AddRow(), sectionTitle, ""); } else { XlHlp.AddSectionInfo(insertAt.AddRow(), sectionTitle, "", orientation: XlOrientation.xlUpward); insertAt.IncrementColumns(); } insertAt.MarkStart(XlHlp.MarkType.GroupTable); addHeaderCommand(insertAt); addBodyCommand(insertAt, buildServer, teamProject); insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("{0}_{1}", tablePrefix, teamProject.Name)); insertAt.Group(insertAt.OrientVertical); insertAt.EndSectionAndSetNextLocation(insertAt.OrientVertical); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } XlHlp.DisplayInWatchWindow("End: " + DateTime.Now); XlHlp.DisplayInWatchWindow(insertAt, startTicks, "End"); return(insertAt); }
private XlHlp.XlLocation AddSection_SiteColumns(XlHlp.XlLocation insertAt, ClientContext ctx, Web web) { XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt); if (insertAt.OrientVertical) { XlHlp.AddTitledInfo(insertAt.AddRow(), "SiteColumns", web.Title); } else { XlHlp.AddTitledInfo(insertAt.AddRow(), "SiteColumns", web.Title, orientation: XlOrientation.xlUpward); insertAt.IncrementColumns(); } var siteColumns = VNCSP.Helper.GetSiteColumns(ctx, web); //ctx.Load(web.Fields); //ctx.ExecuteQuery(); //var siteColumns = web.Fields; //ctx.ExecuteQuery(); insertAt.MarkStart(XlHlp.MarkType.GroupTable); insertAt = DisplayListOf_SiteColumns(insertAt, siteColumns, false, "OneLevel"); insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tblSiteColumns_{0}", web.Title)); insertAt.Group(insertAt.OrientVertical, hide: true); insertAt.EndSectionAndSetNextLocation(insertAt.OrientVertical); XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End"); return(insertAt); }
internal static XlHlp.XlLocation AddSections( XlHlp.XlLocation insertAt, TeamProject teamProject, List <string> sectionsToDisplay) { long startTicks = Log.APPLICATION("Enter", Common.PROJECT_NAME); if (sectionsToDisplay.Count != 0) { if (insertAt.OrientVertical) { //XlHlp.AddContentToCell(insertAt.AddRowX(), "TeamProject (TP) Information"); XlHlp.AddSectionInfo(insertAt.AddRow(), "TeamProject (TP) Information", ""); insertAt.IncrementRows(); } else { //XlHlp.AddContentToCell(insertAt.AddRowX(), "TeamProject (TP) Information"); XlHlp.AddSectionInfo(insertAt.AddRow(), "TeamProject(TP) Information", "", orientation: XlOrientation.xlUpward); insertAt.DecrementRows(); // AddRow bumped it. insertAt.IncrementColumns(); } if (sectionsToDisplay.Contains("Info")) { insertAt = Add_Info(insertAt, teamProject).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("Members")) { insertAt = Add_Members(insertAt, teamProject).IncrementPosition(insertAt.OrientVertical); } } Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks); return(insertAt); }
private XlHlp.XlLocation AddSection_ContentTypes(XlHlp.XlLocation insertAt, ClientContext ctx, Web web) { XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt); if (insertAt.OrientVertical) { XlHlp.AddTitledInfo(insertAt.AddRow(), "ContentTypes", web.Title); } else { XlHlp.AddTitledInfo(insertAt.AddRow(), "ContentTypes", web.Title, orientation: XlOrientation.xlUpward); insertAt.IncrementColumns(); } ctx.Load(web.ContentTypes); ctx.ExecuteQuery(); //IEnumerable<List> cTypes = ctx.LoadQuery(allContentTypes.Where // (list => list.BaseType == BaseType.DocumentLibrary) // ); ctx.ExecuteQuery(); insertAt.MarkStart(XlHlp.MarkType.GroupTable); insertAt = DisplayListOf_ContentTypes(insertAt, web.ContentTypes, false, "Full"); insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tblContentTypes_{0}", web.Title)); insertAt.Group(insertAt.OrientVertical, hide: true); insertAt.EndSectionAndSetNextLocation(insertAt.OrientVertical); XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End"); return(insertAt); }
internal static XlHlp.XlLocation AddSections(XlHlp.XlLocation insertAt, Options_AZDO_TFS options, IBuildServer buildServer, TeamProject teamProject, List <string> sectionsToDisplay) { long startTicks = XlHlp.DisplayInWatchWindow(insertAt); if (sectionsToDisplay.Count > 0) { if (insertAt.OrientVertical) { XlHlp.AddSectionInfo(insertAt.AddRow(), "Build Server (BS) Information", ""); } else { XlHlp.AddSectionInfo(insertAt.AddRow(), "Build Server (BS) Information", "", orientation: XlOrientation.xlUpward); insertAt.DecrementRows(); // AddRow bumped it. insertAt.IncrementColumns(); } //_buildServer.QueryBuildAgents; //_buildServer.QueryBuildControllers; //_buildServer.QueryBuildDefinitions; //_buildServer.QueryBuilds; //_buildServer.QueryBuildServiceHosts; //_buildServer.QueryProcessTemplates; insertAt = Add_Info(insertAt); if (sectionsToDisplay.Contains("Build Agents")) { insertAt = Add_BuildAgents(insertAt, options, buildServer, teamProject).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("Build Controllers")) { insertAt = Add_BuildControllers(insertAt, options, buildServer, teamProject).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("Build Definitions")) { insertAt = Add_BuildDefinitions(insertAt, options, buildServer, teamProject).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("Builds")) { insertAt = Add_Builds(insertAt, options, buildServer, teamProject).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("Build ServiceHosts")) { insertAt = Add_BuildServiceHosts(insertAt, options, buildServer, teamProject).IncrementPosition(insertAt.OrientVertical); } if (sectionsToDisplay.Contains("Build ProcessTemplates")) { insertAt = Add_BuildProcessTemplates(insertAt, options, buildServer, teamProject).IncrementPosition(insertAt.OrientVertical); } } XlHlp.DisplayInWatchWindow(insertAt, startTicks, "End"); return(insertAt); }
internal static void Add_TP_Changesets( XlHlp.XlLocation insertAt, Options_AZDO_TFS options, ICommonStructureService commonStructureService, bool listChanges, bool listWorkItems, IEnumerable history) { Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY); foreach (Changeset changeset in history) { insertAt.ClearOffsets(); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.ChangesetId.ToString()); //XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), changeset.CheckinNote.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.Committer); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.CommitterDisplayName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.Owner); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.OwnerDisplayName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.CreationDate.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.CheckinNote.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.Comment); //XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), changeset.AssociatedWorkItems.Count().ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.Changes.Count().ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.WorkItems.Count().ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.AssociatedWorkItems.Count().ToString()); insertAt.IncrementRows(); if (listChanges) { insertAt.IncrementColumns(); foreach (Change change in changeset.Changes) { try { XlHlp.AddContentToCell(insertAt.AddRowX(1), Section_VersionControlServer.GetChangeInfo(change)); //XlHlp.AddContentToCell(insertAt.AddRow(), GetIterationInfo(workItem)); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } insertAt.DecrementColumns(); } if (listWorkItems) { insertAt.IncrementColumns(); foreach (WorkItem workItem in changeset.WorkItems) { try { XlHlp.AddContentToCell(insertAt.AddRowX(1), Section_VersionControlServer.GetWorkItemInfo(workItem)); XlHlp.AddContentToCell(insertAt.AddRowX(1), Section_VersionControlServer.GetIterationInfo(workItem, commonStructureService)); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } insertAt.DecrementColumns(); } } Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks); }
internal static XlHlp.XlLocation Add_Members( XlHlp.XlLocation insertAt, TeamProject teamProject) { long startTicks = XlHlp.DisplayInWatchWindow(insertAt); try { int currentRows = insertAt.RowsAdded; // Save the location of the count so we can update later after have traversed all items. Range rngTitle = insertAt.GetCurrentRange(); if (insertAt.OrientVertical) { XlHlp.AddSectionInfo(insertAt.AddRow(), "Members Group", ""); } else { XlHlp.AddSectionInfo(insertAt.AddRow(), "Members Group", "", orientation: XlOrientation.xlUpward); insertAt.IncrementColumns(); } TeamFoundationIdentity[] projectGroups = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ListApplicationGroups( teamProject.ArtifactUri.AbsoluteUri, ReadIdentityOptions.None); Dictionary <IdentityDescriptor, object> descriptorSet = new Dictionary <IdentityDescriptor, object>(IdentityDescriptorComparer.Instance); foreach (TeamFoundationIdentity projectGroup in projectGroups) { descriptorSet[projectGroup.Descriptor] = projectGroup.Descriptor; } // Expanded membership of project groups projectGroups = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentities(descriptorSet.Keys.ToArray(), MembershipQuery.Expanded, ReadIdentityOptions.None); // Collect all descriptors foreach (TeamFoundationIdentity projectGroup in projectGroups) { foreach (IdentityDescriptor mem in projectGroup.Members) { descriptorSet[mem] = mem; } } // NOTE(crhodes) // Might need to ensure that _Global_Groups and _Global_Identities already populated. if (Section_TeamProjectCollection._Global_Identities.Count == 0) { TeamFoundationIdentity everyoneExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity( GroupWellKnownDescriptors.EveryoneGroup, MembershipQuery.Expanded, ReadIdentityOptions.None); AZDOHelper.FetchIdentities(everyoneExpanded.Members, Section_TeamProjectCollection._Global_Groups, Section_TeamProjectCollection._Global_Identities); } _TeamProject_Groups.Clear(); _TeamProject_Identities.Clear(); AZDOHelper.FetchIdentities(descriptorSet.Keys.ToArray(), _TeamProject_Groups, _TeamProject_Identities); insertAt.MarkStart(XlHlp.MarkType.GroupTable); // Keep in same order as fields, infra. // Group XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Identifier"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Identity"); // Members XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "IsContainer"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "DisplayName"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 80, "UniqueName"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "IdentityType"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "UniqueUserId"); XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "IsActive"); insertAt.IncrementRows(); foreach (TeamFoundationIdentity identity in _TeamProject_Groups) { foreach (IdentityDescriptor member in identity.Members) { insertAt.ClearOffsets(); try { // Group XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), identity.Descriptor.Identifier); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), identity.DisplayName); // Members // NOTE(crhodes) // This line is throwing exception. Why? XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].IsContainer.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].DisplayName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].UniqueName); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].Descriptor.IdentityType); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].UniqueUserId.ToString()); XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), Section_TeamProjectCollection._Global_Identities[member].IsActive.ToString()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } insertAt.IncrementRows(); } } insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tblTPMembers_{0}", insertAt.workSheet.Name)); insertAt.Group(insertAt.OrientVertical); // Update counts. -2 covers Header and Table Column Header if (insertAt.OrientVertical) { XlHlp.AddLabeledInfoX(rngTitle, "Members Group", (insertAt.RowsAdded - currentRows - 2).ToString()); } else { XlHlp.AddLabeledInfoX(rngTitle, "Members Group", (insertAt.RowsAdded - currentRows - 2).ToString(), orientation: XlOrientation.xlUpward); } insertAt.EndSectionAndSetNextLocation(insertAt.OrientVertical); //insertAt.AddRow(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } XlHlp.DisplayInWatchWindow(insertAt, startTicks, "End"); return(insertAt); }