Check existing content types before creating

Topics: Writing modules
Jun 21, 2013 at 4:19 PM
I am building an events calendar module and part of the Create Migration method I am creating an new Content Type "Event" but since that is a vague Type name I would like to check to see if a Type of that name exists already and if so Name it something more specific and if not just create it as an event. I feel doing that will make it more portable for users that have already created an Event Type and to prevent name collisions.

Is this possible to do?
Jun 24, 2013 at 2:44 PM
You could do such check with IContentDefinitionManager, but... It's better to name your content type more specific if you don't want such collisions. Changing the content type name dynamically can cause confusion when you (or others) want to query those items because the name of the content type won't be obvious.
Jun 25, 2013 at 3:14 PM
Good point, I guess I will just have to tag it with a unique name.