umbraco 4.0Reference
A collection of code samples to perform common tasks with the umbraco API such as creating and publish documents, members and users.
Sample code to attach to document events
remember to add the cms.dll, businesslogic.dll and umbraco.dll to your project.
Add references to the right namespaces at the top of your .cs file
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.web;
Attach to the beforePublish event
protected void Page_Load(object sender, EventArgs e) {
Document.BeforePublish += new Document.PublishingEventHandler(Document_BeforePublish);
}
void Document_BeforePublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e) {
Response.Write(sender.Text + " is about to be published");
//if you wish to cancel the publish about to happen, simply set Eventargs cancel = true
e.Cancel = true;
}