I would like to create new doctype's ( and child doc type's ) using the API and I was hoping someone can point me in the right direction as I've Googled and searched the Forum but with no success.
Long story short it's going to be a bit of a pain and a you may end up with magic numbers in your code. The number passed into GetDataTypeDefinition is the ID of the data type you want to use.
Creating Umbraco DocType's using the API
Hi All,
I would like to create new doctype's ( and child doc type's ) using the API and I was hoping someone can point me in the right direction as I've Googled and searched the Forum but with no success.
Any pointers would be much appreciated!
Cheers,
Chris
Here is the API reference: http://umbraco.org/apiDocs/index.html
/Jan
Whoops - forgot to also mention the API cheatsheet from the wiki on our, which you'll find here: http://our.umbraco.org/wiki/reference/api-cheatsheet
/Jan
Did it like this a while back (on a v3, so not sure if this still works):
Or try looking at the package installer in the umbraco v4 sourcecode
Try this:
Long story short it's going to be a bit of a pain and a you may end up with magic numbers in your code. The number passed into GetDataTypeDefinition is the ID of the data type you want to use.
MasterContentType is the parent.
You don't really have to call save, the only reason I put it there was so that the events fire correctly, saving happens at every other line (see: http://www.aaron-powell.com/blog/july-2009/the-great-umbraco-api-misconception.aspx).
All the stuff you want is in the cms.dll assembly.
@Tim - wont your solution only work if you want to use the API and not really use the API?
Hi Tim / Slace & Jan,
Thank you all for your replies, I am going to continue working on this and I will post my final solution when I've cracked it :)
Cheers,
Chris
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.