Applies to Umbraco 6.x and newer
The ContentTypeService acts as a "gateway" to Umbraco data for operations which are related to ContentTypes and MediaTypes.
Browse the API documentation for ContentTypeService.
- Namespace:
Umbraco.Core.Services - Assembly:
Umbraco.Core.dll
All samples in this document will require references to the following dll:
- Umbraco.Core.dll
All samples in this document will require the following usings:
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
Please note that this page will be updated with samples and additional information about the methods listed below
The ContentTypeService is available through the ApplicationContext, but the if you are using a SurfaceController or the UmbracoUserControl then the ContentTypeService is available through a local Services property.
Services.ContentTypeService
Getting the service through the ApplicationContext:
ApplicationContext.Current.Services.ContentTypeService
Gets a ContentType object by its Id.
Gets a ContentType object by its Alias.
Gets a list of all available ContentType objects.
Gets a list of children for a ContentType object by the Parent Id.
Saves a single ContentType object.
Saves a list of ContentType objects.
Deletes a single ContentType object
Deletes a list of ContentType objects.
Gets a MediaType object by its Id.
Gets a MediaType object by its Alias.
Gets a list of all available MediaType objects.
Gets a list of children for a MediaType object by the Parent Id.
Saves a single MediaType object.
Saves a list of MediaType objects.
Deletes a single MediaType object.
Deletes a list of MediaType objects.