Using umbraco API to delete ContentType Options
ni5ni6
Posted: Wednesday, August 13, 2008 2:38:06 PM
Rank: Enthusiast

Joined: 12/18/2007
Posts: 34
Hey folks,
I have a task to delete instance of ContentType using API functions, but method delete() has 'protected' access level. Is it right to use ContentItemType.delete() instead?
Thanks!!
n.
ni5ni6
Posted: Wednesday, August 13, 2008 2:41:29 PM
Rank: Enthusiast

Joined: 12/18/2007
Posts: 34
actually, I am not quite sure what are the differences between
ContentItem and Content
or
ContentItemType and ContentType
...?
Cheers!
n.
ni5ni6
Posted: Monday, September 01, 2008 2:07:13 PM
Rank: Enthusiast

Joined: 12/18/2007
Posts: 34
OK, I still dont know what is ContentItem and ContentItemType used for, but I managed to delete ContentType using umbraco API functions.
The trick is actually that I was supposed to use DocumentType class and its method delete() instead of ContentType or ContentItemType classes.
The actual code that might help you if you have the ID of Document Type you want to delete, looks like this:
Code:
ContentType contentType = ContentType.GetContentType(YOURDOCUMENTTYPE.Id);
DocumentType dt = DocumentType.GetByAlias(contentType.Alias);
dt.delete();


Hope this helps someone..
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.