Ejemplo n.º 1
0
        //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)
        {
            long startTicks = XlHlp.DisplayInWatchWindow(insertAt);

            if (insertAt.OrientVertical)
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Lists", web.Title);
            }
            else
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "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(insertAt, startTicks, "End");

            return(insertAt);
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        internal static void CreateWS_All_TPC_LastChangeset(Options_AZDO_TFS options,
                                                            VersionControlServer versionControlServer)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            try
            {
                XlHlp.XlLocation insertAt = CreateNewWorksheet(string.Format("{0}_{1}", "All_TPC", "LastChangeset"),
                                                               options);

                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Last Changeset All TeamProjects", AzureDevOpsExplorer.Presentation.Views.Server.TfsTeamProjectCollection.Name);

                insertAt.MarkStart(XlHlp.MarkType.GroupTable);

                Header_VersionControlServer.Add_Changesets(insertAt);

                //Body_VersionControlServer.Add_Changesets(insertAt, options, versionControlServer);

                foreach (var teamProjectName in options.TeamProjects)
                {
                    insertAt.ClearOffsets();

                    long loopTicks = Log.Trace($"Processing {teamProjectName}", Common.PROJECT_NAME);

                    TeamProject teamProject = VNCTFS.Helper.Get_TeamProject(versionControlServer, teamProjectName.Trim());

                    if (teamProject != null)
                    {
                        Globals.ThisAddIn.Application.StatusBar = $"Processing {teamProject.Name}";

                        Body_VersionControlServer.Add_TP_Changesets(insertAt, options,
                                                                    Presentation.Views.Server.VersionControlServer, teamProject);

                        AZDOHelper.ProcessLoopDelay(options);
                    }
                    else
                    {
                        XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), teamProjectName);
                        XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), "No VCS Project");
                        insertAt.IncrementRows();
                    }

                    Log.Trace($"EndProcessing {teamProjectName}", Common.PROJECT_NAME, loopTicks);
                }

                insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tbl_{0}", insertAt.workSheet.Name));

                insertAt.Group(insertAt.OrientVertical, hide: true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);
        }
Ejemplo n.º 4
0
        private XlHlp.XlLocation CreateNewWorksheet(string sheetName,
                                                    Options_AZDO_TFS options, [CallerMemberName] string callerName = "")
        {
            Int64 startTicks = Log.APPLICATION($"Begin: sheetName: {sheetName}", Common.PROJECT_NAME);

            string    safeSheetName = XlHlp.SafeSheetName(sheetName);
            Worksheet ws            = XlHlp.NewWorksheet(safeSheetName, beforeSheetName: "FIRST");

            XlHlp.XlLocation insertAt = new XlHlp.XlLocation(ws, options.StartingRow, options.StartingColumn, options.OrientOutputVertically);
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Date Run", DateTime.Now.ToString());

            XlHlp.DisplayInWatchWindow("End", startTicks);

            if (!options.FormatSpecs.IsInitialized)
            {
                options.FormatSpecs.Initialize(insertAt);
            }

            using (System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog())
            {
                string strOutputFile = null;
                try
                {
                    saveFileDialog.FileName = "AzureDevOpsExplorer.xlsx";
                    //saveFileDialog.InitialDirectory = startingFolder;

                    if (System.Windows.Forms.DialogResult.Cancel == saveFileDialog.ShowDialog())
                    {
                        Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks);
                        return(insertAt);
                    }
                    else
                    {
                        strOutputFile = saveFileDialog.FileName;
                    }

                    if (string.IsNullOrEmpty(strOutputFile))
                    {
                        Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks);
                        return(insertAt);
                    }

                    Globals.ThisAddIn.Application.ActiveWorkbook.SaveAs(strOutputFile);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            Log.APPLICATION("Exit", Common.PROJECT_NAME, startTicks);

            return(insertAt);
        }
Ejemplo n.º 5
0
        private XlHlp.XlLocation AddSection_SiteColumns(XlHlp.XlLocation insertAt, ClientContext ctx, Web web)
        {
            long startTicks = XlHlp.DisplayInWatchWindow(insertAt);

            if (insertAt.OrientVertical)
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "SiteColumns", web.Title);
            }
            else
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "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(insertAt, startTicks, "End");

            return(insertAt);
        }
Ejemplo n.º 6
0
        private XlHlp.XlLocation AddSection_ContentTypes(XlHlp.XlLocation insertAt, ClientContext ctx, Web web)
        {
            long startTicks = XlHlp.DisplayInWatchWindow(insertAt);

            if (insertAt.OrientVertical)
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "ContentTypes", web.Title);
            }
            else
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "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(insertAt, startTicks, "End");

            return(insertAt);
        }
Ejemplo n.º 7
0
        internal static XlHlp.XlLocation AddSection_OperationalDatabaseNames(XlHlp.XlLocation insertAt)
        {
            long startTicks = Log.Trace("Enter", Common.PROJECT_NAME);

            XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Operational Database Names:", "");

            insertAt.MarkStart(XlHlp.MarkType.GroupTable);

            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "AnalysisCube:", $"{OperationalDatabaseNames.AnalysisCube}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "CoreServices:", $"{OperationalDatabaseNames.CoreServices}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "DeploymentRig:", $"{OperationalDatabaseNames.DeploymentRig}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "LabExecution:", $"{ OperationalDatabaseNames.LabExecution}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "TeamBuild:", $"{OperationalDatabaseNames.TeamBuild}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "TestRig:", $"{ OperationalDatabaseNames.TestRig}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "VersionControl:", $"{ OperationalDatabaseNames.VersionControl}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "Warehouse:", $"{ OperationalDatabaseNames.Warehouse}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "WorkItemTracking:", $"{OperationalDatabaseNames.WorkItemTracking}");
            XlHlp.AddLabeledInfoX(insertAt.AddRowX(2), "WorkItemTrackingAttachments:", $"{OperationalDatabaseNames.WorkItemTrackingAttachments}");

            Log.Trace("Exit", Common.PROJECT_NAME, startTicks);

            return(insertAt);
        }
Ejemplo n.º 8
0
        private static string CopyRowsToNewWorkSheet(Worksheet sourceWs, int startRow, int endRow, string sheetName)
        {
            sheetName = XlHlp.SafeSheetName(sheetName);
            Worksheet destinationWS = XlHlp.NewWorksheet(sheetName, afterSheetName: "LAST");

            XlHlp.XlLocation insertAt = new XlHlp.XlLocation(destinationWS, row: 5, column: 1);

            insertAt.MarkStart(XlHlp.MarkType.GroupTable);

            CreateLogWorkSheetHeader(insertAt);

            insertAt.AddRowX();

            // HACK(crhodes)
            //
            // There are 14 columns normally, grab five more just in case
            // We can do better than this by finding the last active column.
            // Extra columns can appear when an exception messes up the formatting of the log file.

            Range sourceRng;

            sourceRng = sourceWs.Range[sourceWs.Cells[startRow, 1], sourceWs.Cells[endRow, 19]];  //.Cells[startRow, 1];

            sourceRng.Copy();

            insertAt.GetCurrentRange().PasteSpecial();

            destinationWS.Activate();

            // Things come over messed up.  Unfreeze
            //Globals.ThisAddIn.Application.ActiveWindow.FreezePanes = false;

            Range rng;

            rng = destinationWS.Cells[5, 1];

            Int32 lastRow    = rng.SpecialCells(XlCellType.xlCellTypeLastCell).Row;
            Int32 lastColumn = rng.SpecialCells(XlCellType.xlCellTypeLastCell).Column;

            XlHlp.DisplayInWatchWindow(string.Format("{0}() row:({1}) col:({2})",
                                                     MethodBase.GetCurrentMethod().Name, lastRow, lastColumn));

            insertAt.SetRow(lastRow + 1);
            insertAt.SetColumn(lastColumn);

            insertAt.MarkEnd(VNC.AddinHelper.Excel.MarkType.GroupTable, string.Format("tbl_{0}", destinationWS.Name));

            //rng = destinationWS.Columns["E:K"];
            //rng.Columns.Group();
            destinationWS.Columns["E:K"].Columns.Group();

            //destinationWS.Cells[6, 14].Select();

            //destinationWS.Application.ActiveWindow.FreezePanes = true;

            // TODO(crhodes)
            // Figure out what to do to make outlining work.

            //sourceWs.Outline.SummaryColumn = XlSummaryColumn.xlSummaryOnLeft;
            //sourceWs.Outline.SummaryRow = XlSummaryRow.xlSummaryAbove;
            return(sheetName);
        }
Ejemplo n.º 9
0
        private void btnTimeInsertAtLight_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Office.Interop.Excel.Application app = Globals.ThisAddIn.Application;

            teDuration.Clear();

            int insertRow;
            int insertCol;
            int iterations;

            if (!int.TryParse(teStartRow.Text, out insertRow))
            {
                MessageBox.Show("Illegal StartRow");
                teStartRow.Focus();
                return;
            }

            if (!int.TryParse(teStartCol.Text, out insertCol))
            {
                MessageBox.Show("Illegal StartCol");
                teStartCol.Focus();
                return;
            }

            if (!int.TryParse(teIterations.Text, out iterations))
            {
                MessageBox.Show("Illegal Iterations");
                teIterations.Focus();
                return;
            }

            if (!(bool)ceScreenUpdates.IsChecked)
            {
                XlHlp.ScreenUpdatesOff();
            }

            if (!(bool)ceCalculations.IsChecked)
            {
                XlHlp.CalculationsOff();
            }

            long startTicks = XlHlp.DisplayInWatchWindow("Start");

            if ((bool)ceInsertDescending.IsChecked)
            {
                XlHlp.XlLocation insertAt = new XlHlp.XlLocation(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet, insertRow, insertCol);

                insertRow += iterations;

                for (int i = 0; i < iterations; i++)
                {
                    XlHlp.AddContentToCell(insertAt.AddRowX(), string.Format("{0,5}-1", insertRow + i));
                }
            }
            else
            {
                XlHlp.XlLocation insertAt = new XlHlp.XlLocation(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet, insertRow, insertCol);

                for (int i = 0; i < iterations; i++)
                {
                    XlHlp.AddContentToCell(insertAt.AddRowX(), string.Format("{0,5}-1", insertRow + i));
                }
            }

            long endTicks = XlHlp.DisplayInWatchWindow("End", startTicks);

            teDuration.Text = ((endTicks - startTicks) / ((double)Stopwatch.Frequency)).ToString();

            XlHlp.ScreenUpdatesOn(true);
            XlHlp.CalculationsOn();
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        internal static XlHlp.XlLocation Add_Members(
            XlHlp.XlLocation insertAt,
            Options_AZDO_TFS options)
        {
            long startTicks = XlHlp.DisplayInWatchWindow(insertAt);

            TeamFoundationIdentity everyone = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.EveryoneGroup, MembershipQuery.Direct, ReadIdentityOptions.None);

            TeamFoundationIdentity licensees = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.LicenseesGroup, MembershipQuery.Direct, ReadIdentityOptions.None);

            TeamFoundationIdentity namespaceAdministrators = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.NamespaceAdministratorsGroup, MembershipQuery.Direct, ReadIdentityOptions.None);

            TeamFoundationIdentity serviceUsers = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.ServiceUsersGroup, MembershipQuery.Direct, ReadIdentityOptions.None);

            if (everyone != null)
            {
                insertAt.ClearOffsets();

                XlHlp.AddLabeledInfo(insertAt.AddRow(), "Everyone", everyone.Members.Count().ToString());

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), everyone.DisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), everyone.UniqueName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), everyone.Descriptor.IdentityType);

                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddLabeledInfo(insertAt.AddRow(), "Everyone", "null");
            }

            if (licensees != null)
            {
                insertAt.ClearOffsets();

                XlHlp.AddLabeledInfo(insertAt.AddRow(), "Licensees", licensees.Members.Count().ToString());

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), licensees.DisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), licensees.UniqueName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), licensees.Descriptor.IdentityType);

                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "Licensees", "null");
            }

            if (namespaceAdministrators != null)
            {
                insertAt.ClearOffsets();

                XlHlp.AddLabeledInfo(insertAt.AddRow(), "NamespaceAdministrators", namespaceAdministrators.Members.Count().ToString());

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), namespaceAdministrators.DisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), namespaceAdministrators.UniqueName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), namespaceAdministrators.Descriptor.IdentityType);

                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddLabeledInfo(insertAt.AddRow(), "NamespaceAdministrators", "null");
            }

            if (serviceUsers != null)
            {
                insertAt.ClearOffsets();

                XlHlp.AddLabeledInfo(insertAt.AddRow(), "ServiceUsers", serviceUsers.Members.Count().ToString());

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), serviceUsers.DisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), serviceUsers.UniqueName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), serviceUsers.Descriptor.IdentityType);

                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "ServiceUsers", "null");
            }

            TeamFoundationIdentity everyoneExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.EveryoneGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);

            TeamFoundationIdentity everyoneExpanded2 = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.EveryoneGroup, MembershipQuery.Expanded, ReadIdentityOptions.IncludeReadFromSource);

            if (everyoneExpanded != null)
            {
                AZDOHelper.FetchIdentities(everyoneExpanded.Members, _Global_Groups, _Global_Identities);
            }

            TeamFoundationIdentity licenseesExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.LicenseesGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);

            if (licenseesExpanded != null)
            {
                AZDOHelper.FetchIdentities(licenseesExpanded.Members, _Global_Groups, _Global_Identities);
            }

            TeamFoundationIdentity serviceUsersExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.ServiceUsersGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);

            if (serviceUsersExpanded != null)
            {
                AZDOHelper.FetchIdentities(serviceUsersExpanded.Members, _Global_Groups, _Global_Identities);
            }

            TeamFoundationIdentity namespaceAdministratorsExpanded = AzureDevOpsExplorer.Presentation.Views.Server.IdentityManagementService.ReadIdentity(
                GroupWellKnownDescriptors.NamespaceAdministratorsGroup, MembershipQuery.Expanded, ReadIdentityOptions.None);

            if (namespaceAdministratorsExpanded != null)
            {
                AZDOHelper.FetchIdentities(namespaceAdministratorsExpanded.Members, _Global_Groups, _Global_Identities);
            }

            XlHlp.AddLabeledInfoX(insertAt.AddRowX(), "All Groups and Identities", "Lots");

            insertAt.MarkStart(XlHlp.MarkType.GroupTable);

            // Keep in same order as fields, infra.

            // Group

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Top Level");

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Group Identifier");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "Group Identity");

            // Members

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "IsContainer");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "TeamFoundationId");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "DisplayName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 80, "UniqueName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "IdentityType");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Identity");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "UniqueUserId");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "IsActive");


            insertAt.IncrementRows();

            foreach (TeamFoundationIdentity identity in _Global_Groups)
            {
                Globals.ThisAddIn.Application.StatusBar = "Processing " + identity.DisplayName;

                foreach (IdentityDescriptor member in identity.Members)
                {
                    insertAt.ClearOffsets();

                    // Top Level

                    string topLevel = "";

                    MatchCollection matches = Regex.Matches(identity.DisplayName, @"\[.*\]");

                    if (matches.Count == 1)
                    {
                        topLevel = matches[0].Value;
                    }
                    else
                    {
                        topLevel = identity.DisplayName;
                    }

                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), topLevel);

                    // Group

                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), identity.Descriptor.Identifier);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), identity.DisplayName);

                    // Members

                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].IsContainer.ToString());
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].TeamFoundationId.ToString());
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].DisplayName);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].UniqueName);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].Descriptor.IdentityType);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].Descriptor.Identifier);
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].UniqueUserId.ToString());
                    XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), _Global_Identities[member].IsActive.ToString());

                    insertAt.IncrementRows();
                }
            }

            insertAt.MarkEnd(XlHlp.MarkType.GroupTable, string.Format("tblMembers_{0}", insertAt.workSheet.Name));

            insertAt.Group(insertAt.OrientVertical);

            if (!insertAt.OrientVertical)
            {
                // Skip past the info just added.
                insertAt.SetLocation(insertAt.RowStart, insertAt.MarkEndColumn + 1);
            }

            XlHlp.DisplayInWatchWindow(insertAt, startTicks, "End");

            return(insertAt);
        }