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