Saturday, 21 July 2012

Create Dynamic Pages

  protected void Createdynamicpage(string pagename)
        {
            SPSite site = SPContext.Current.Site;
            using (SPWeb web = site.OpenWeb())
            {

                SPList list = web.Lists["Pages"];
                string postInformation =

                  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +

                  "<Method>" +

                    "<SetList Scope=\"Request\">" + list.ID + "</SetList>" +

                    "<SetVar Name=\"ID\">New</SetVar>" +

                    "<SetVar Name=\"Cmd\">NewWebPage</SetVar>" +

                    "<SetVar Name=\"Type\">WebPartPage</SetVar>" +

                    "<SetVar Name=\"WebPartPageTemplate\">1</SetVar>" +

                    "<SetVar Name=\"Title\">" + pagename + "</SetVar>" +

                    "<SetVar Name=\"Overwrite\">true</SetVar>" +

                  "</Method>";
                string processBatch = web.ProcessBatchData(postInformation);
                web.Update();
            }
        }

No comments:

Post a Comment

SharePoint online - Get List-item attachments and Display to div

Step 1 : Create a List ex: TestList and attach few images Step 2 : Copy and Pastet the below coding in App.js var  Items =  null ; ...