I have just started using Sharepoint Foundation 2010 and I'm trying to write a function from c# to add pages to a site.
I got some code working to create a new site, but I can't seem to find any documentation about adding a page to an existing site using the client object model.
This is probably a simple question but if anyone can help me out I would appreciated it.
Thanks.
Update
This is what I have so far:
private void createPage()
{
ClientContext context = new ClientContext(url);
Site siteCollection = context.Site;
Web site = context.Web;
List pages = site.Lists.GetByTitle("Pages");
FileCreationInformation fileCreateInfo = new FileCreationInformation();
fileCreateInfo.Url = "NewPage";
fileCreateInfo.Content = System.Text.Encoding.ASCII.GetBytes("Test");
context.Load(pages.RootFolder.Files.Add(fileCreateInfo));
context.ExecuteQuery();
context.Dispose();
}
But I get a server exception "List 'Pages' does not exist at site with URL"