Is it possible to hit the new page created event.
I want to create som subpage when a root page has been created.
I have this right now, and I don't think that's the way to go
public class ContentServiceSavingComponent : IComponent
{
// initialize: runs once when Umbraco starts
public void Initialize()
{
ContentService.Saving += ContentService_Saving;
}
// terminate: runs once when Umbraco stops
public void Terminate()
{
}
private void ContentService_Saving(IContentService sender, ContentSavingEventArgs e)
{
foreach (var root in e.SavedEntities
//Check if the content item type has a specific alias
.Where(c => c.ContentType.Alias.InvariantEquals("Frontpage")))
{
if (root.Id == 0)
{
var udi = new GuidUdi("document", root.Key);
ContentService.CreateAndSave("FROM CODE", root.Id, "libraryFolder");
}
//Do something if the content is using the MyContentType doctype
}
}
}
I will only do this when a new page is created.
Hope any one can help!
Create new page event
Hey :)
Is it possible to hit the new page created event. I want to create som subpage when a root page has been created.
I have this right now, and I don't think that's the way to go
I will only do this when a new page is created. Hope any one can help!
Thanks!
is working on a reply...