title: Create a webpart page with an webpart with in it programmatically
body: <p>I want to create several webpart pages (programmatically) with custom web parts in it.
  I have searched the internetz but couldn't find anything that I could get to work.</p>
  
  <p>Here is my code so far (where I create a welcome page, not a webpart page):</p>
  
  <pre><code>using (SPSite site = new SPSite("http://v99-sp-public/"))
              {
                  using (SPWeb web = site.OpenWeb())
                  {
                      PublishingSite pSite = new PublishingSite(site);
                      SPContentType ctype = pSite.ContentTypes["Welcome Page"];
                      PageLayoutCollection pageLayouts = pSite.GetPageLayouts(ctype, true);
                      PageLayout pageLayout = pageLayouts["/_catalogs/masterpage/welcomesplash.aspx"];
                      PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(web);
                      PublishingPageCollection pPages = pWeb.GetPublishingPages();
                      PublishingPage pPage = pPages.Add("Klanten2.aspx", pageLayout);
                      SPListItem newpage = pPage.ListItem;
                      newpage["Title"] = "Klanten";
  
                      newpage.Update();
  
                      newpage.File.CheckIn("Checkin");
                      newpage.File.Publish("Publisch");
                   }
                }
  </code></pre>
  
  <p>Please help me out,</p>
  
  <p>Thanks.</p>