예제 #1
0
        private XlHlp.XlLocation DisplayListOf_ContentTypes(XlHlp.XlLocation insertAt, ContentTypeCollection contentTypes, bool displayDataOnly, string tableSuffix)
        {
            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt);

            Worksheet ws = insertAt.workSheet;

            if (!displayDataOnly)
            {
                insertAt.MarkStart(XlHlp.MarkType.GroupTable);

                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Name");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Group");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Id");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "SchemaXml");

                insertAt.IncrementRows();
            }

            foreach (var cType in contentTypes)
            {
                insertAt.ClearOffsets();

                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), cType.Name);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), cType.Group);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), cType.Id.ToString());
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), cType.SchemaXml);

                insertAt.IncrementRows();
            }

            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End");

            return(insertAt);
        }
예제 #2
0
        private VNC.AddinHelper.Excel.XlLocation DisplayListOf_Lists(VNC.AddinHelper.Excel.XlLocation insertAt, IEnumerable <List> lists, bool displayDataOnly, string tableSuffix)
        {
            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt);

            Worksheet ws = insertAt.workSheet;

            if (!displayDataOnly)
            {
                insertAt.MarkStart(XlHlp.MarkType.GroupTable);

                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Title");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Id");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "SchemaXml");

                insertAt.IncrementRows();
            }

            foreach (var list in lists)
            {
                insertAt.ClearOffsets();

                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), list.Title);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), list.Id.ToString());
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), list.SchemaXml);

                insertAt.IncrementRows();
            }

            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End");

            return(insertAt);
        }
예제 #3
0
        internal static void Add_BuildAgents(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Name");
            //XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Description");
            //XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "QueueStatus");

            insertAt.IncrementRows();
        }
예제 #4
0
        internal static void Add_BuildServiceHosts(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Name");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Status");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "StatusChangedOn");

            insertAt.IncrementRows();
        }
예제 #5
0
        internal static void Add_BuildProcessTemplates(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Id");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Description");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "TemplateType");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Version");

            insertAt.IncrementRows();
        }
예제 #6
0
        internal static void Add_BuildControllers(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Name");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Description");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "Enabled");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "AgentsCount");

            insertAt.IncrementRows();
        }
        internal static void Add_Changesets(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Team Project");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Changeset ID");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Creation Date");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Supported Features");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "WebService Level");

            insertAt.IncrementRows();
        }
        internal static void Add_TP_Developers(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "TFS Team Project");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Developer");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Changeset Count");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Earliest Date");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Latest Date");

            insertAt.IncrementRows();
        }
예제 #9
0
        internal static void Add_Builds(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "BuildController");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LabelName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "StartTime");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 10, "FinishTime");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Finished");

            insertAt.IncrementRows();
        }
예제 #10
0
        internal static void Add_TP_Workspaces(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Computer");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Name");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "OwnerDisplayName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "OwnerName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "LastAccessDate");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Comment");

            insertAt.IncrementRows();
        }
예제 #11
0
        internal static void Add_Shelvesets(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "OwnerDisplayName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "OwnerName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Name");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "CreationDate");
            //ExcelHlp.AddColumnHeaderToheet(insertAt.AddOffsetCoumn(), 20, "DisplayName");
            //ExcelHlp.AddColumnHeaderToheet(insertAt.AddOffsetCoumn(), 20, "QualifiedName");

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "CheckinNote");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Comment");

            insertAt.IncrementRows();
        }
예제 #12
0
        internal static void Add_TP_Teams(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "TeamProject");

            // Team

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Team");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Description");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 5, "DefaultTeam");

            // Members

            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "DisplayName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "UniqueName");

            insertAt.IncrementRows();
        }
예제 #13
0
        internal static void Add_TP_Changesets(XlHlp.XlLocation insertAt)
        {
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "ChangesetId");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Committer");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Committer DisplayName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Owner");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Owner DisplayName");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "CreationDate");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 50, "CheckinNote");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Comment");
            //ExcelHlp.AddColumnHeaderToheet(insertAt.AddOffsetCoumn(),ciatedWorkItems");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Changes");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "WorkItems");
            XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "Associated WorkItems");

            insertAt.IncrementRows();
        }
예제 #14
0
        private XlHlp.XlLocation DisplayListOf_SiteColumns(XlHlp.XlLocation insertAt, IEnumerable <Field> siteColumns, bool displayDataOnly, string tableSuffix)
        {
            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt);

            Worksheet ws = insertAt.workSheet;

            //<Field
            //ID="{56747800-D36E-4625-ABE3-B1BC74A7D5F8}"
            //Name="LowerValuesAreBetter"
            //StaticName="LowerValuesAreBetter"
            //Description="Whether lower is better or higher is better"
            //Group="Status Indicators" Type="Boolean"
            //DisplayName="Lower values are better"
            //SourceID="http://schemas.microsoft.com/sharepoint/v3" />

            //<Field
            //Type="Lookup"
            //DisplayName="FA Page Type"
            //Required="FALSE"
            //EnforceUniqueValues="FALSE"
            //List="{b1d6a5ff-876b-4761-a05d-210038e31639}"
            //WebId="666b287f-2709-476b-a739-e1de9150fb37"
            //ShowField="Title"
            //UnlimitedLengthInDocumentLibrary="FALSE"
            //Group="Custom Columns"
            //ID="{3090abc3-526c-458f-9c65-302ad853db65}"
            //SourceID="{666b287f-2709-476b-a739-e1de9150fb37}"
            //StaticName="FA_x0020_Page_x0020_Type"
            //Name="FA_x0020_Page_x0020_Type" />


            if (!displayDataOnly)
            {
                insertAt.MarkStart(XlHlp.MarkType.GroupTable);

                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Title");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Name");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "StaticName");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Description");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Group");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Id");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "TypeAsString");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "SchemaXml");

                insertAt.IncrementRows();
            }

            foreach (var field in siteColumns)
            {
                insertAt.ClearOffsets();

                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.Title);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.Group);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.Id.ToString());
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.TypeAsString.ToString());
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.SchemaXml);

                insertAt.IncrementRows();
            }

            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End");

            return(insertAt);
        }
예제 #15
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);
        }
예제 #16
0
        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);
        }