asolovyov
asolovyov

Reputation: 963

How to create programmatically DocumentType in Umbraco 5

I'm using Umbraco 5. Is it possible to create new Document Type programmatically using Umbraco API? Thanks.

Upvotes: 0

Views: 1314

Answers (2)

Desarrollo BlueSoft
Desarrollo BlueSoft

Reputation: 18

You can take a look at uSiteBuilder http://usitebuilder.vegaitsourcing.rs/.

It let's you create and update document types with simple POCO classes using attributes.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Vega.USiteBuilder;

namespace MySite.DocumentTypes {
    [DocumentType(AllowedTemplates = new string[] { "MyTemplateAlias" }, 
        IconUrl = "doc4.gif", Thumbnail = "docWithImage.png", 
        AllowedChildNodeTypes = new Type[] { typeof(MySite.DocumentTypes.ContentPage) })
    ]
    public class HomePage : MySite.DocumentTypes.PageBase {
    }
}

Upvotes: 0

LordToro
LordToro

Reputation: 26

There is a project called Umbraco.Cms.Packages.DevDataset in Umbraco 5 source code that has the way to create documment type, template, content node data etc.

You should definitely have a look :)

Upvotes: 1

Related Questions