The legacy wiki pages are here for reference purposes only.
For up-to-date information make sure to check the documentation section.

Sample code to create a document and then publish it.

Remember to add the cms.dll, businesslogic.dll and umbraco.dll to your project.

Add references to the following namespaces at the top of your .cs file

using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.web;

Perform the creation

// Create a document with the appropriate name, root node id, and document type alias.
IContent doc = ApplicationContext.Services.ContentService.CreateContent("My new document", -1, "documentTypeAlias");

// Set properties // See this article for setting properties of the document:

// Save and Publish ApplicationContext.Services.ContentService.SaveAndPublish(doc); is the community mothership for Umbraco, the open source cms. With a friendly forum for all your questions, a comprehensive documentation and a ton of packages from the community. This site is running Umbraco version 7.5.2