コード例 #1
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);
            }
        }