Not sure if this is asked, but searching hasn't quite yielded what I'm looking for. I have a page layout already, what I need to do is programmatically create a page in the Pages library.
I'm fuzzy on the details, but somehow I think I will need to open the Layout, then stream it to a page and then save the page. I'm unsure how to go about this.
The page is context sensitive so I think I'll begin with using SPSite and SPWeb to get access to the lists.
What I'm unclear on is, how can I get the Layouts? I think I should be able to add a page somewhat like this:
 SPWeb web = SPContext.Current.Site.OpenWeb();
                    SPList Pages = web.Lists["Pages"];
                    SPListItemCollection splc = Pages.Items;
                    foreach (SPListItem spli in splc)
                    {
                        if (spli.Name == "lmIntraTopicsArticle")
                        {
                        }
                    }
                    SPListItem sli = splc.Add();
                    Pages.Update();
                    SPFolder PagesFolder = Pages.RootFolder;
                    byte[] layoutContents = new byte[20];
                    SPFile myNewPage = PagesFolder.Files.Add(PagesFolder.Url + "/TopicWindowArchive.aspx", layoutContents);
                    web.Update();
Now I need to figure out how to add content from a layout. Update in a few if I figure it out.
Thank you,