Table of Contents

Class ContentTypeController

Namespace
Umbraco.Cms.Web.BackOffice.Controllers
Assembly
Umbraco.Web.BackOffice.dll

An API controller used for dealing with content types

public class ContentTypeController : ContentTypeControllerBase<IContentType>
Inheritance
ContentTypeController
Inherited Members

Constructors

ContentTypeController(ICultureDictionary, IContentTypeService, IMediaTypeService, IMemberTypeService, IUmbracoMapper, ILocalizedTextService, IEntityXmlSerializer, PropertyEditorCollection, IBackOfficeSecurityAccessor, IDataTypeService, IShortStringHelper, IFileService, ILogger<ContentTypeController>, IContentService, IContentTypeBaseServiceProvider, IHostingEnvironment, EditorValidatorCollection, PackageDataInstallation)

[Obsolete("Use constructor that takes BlockGridSampleHelper as a parameter")]
public ContentTypeController(ICultureDictionary cultureDictionary, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, IUmbracoMapper umbracoMapper, ILocalizedTextService localizedTextService, IEntityXmlSerializer serializer, PropertyEditorCollection propertyEditors, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IDataTypeService dataTypeService, IShortStringHelper shortStringHelper, IFileService fileService, ILogger<ContentTypeController> logger, IContentService contentService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IHostingEnvironment hostingEnvironment, EditorValidatorCollection editorValidatorCollection, PackageDataInstallation packageDataInstallation)

Parameters

cultureDictionary ICultureDictionary
contentTypeService IContentTypeService
mediaTypeService IMediaTypeService
memberTypeService IMemberTypeService
umbracoMapper IUmbracoMapper
localizedTextService ILocalizedTextService
serializer IEntityXmlSerializer
propertyEditors PropertyEditorCollection
backofficeSecurityAccessor IBackOfficeSecurityAccessor
dataTypeService IDataTypeService
shortStringHelper IShortStringHelper
fileService IFileService
logger ILogger<ContentTypeController>
contentService IContentService
contentTypeBaseServiceProvider IContentTypeBaseServiceProvider
hostingEnvironment IHostingEnvironment
editorValidatorCollection EditorValidatorCollection
packageDataInstallation PackageDataInstallation

ContentTypeController(ICultureDictionary, IContentTypeService, IMediaTypeService, IMemberTypeService, IUmbracoMapper, ILocalizedTextService, IEntityXmlSerializer, PropertyEditorCollection, IBackOfficeSecurityAccessor, IDataTypeService, IShortStringHelper, IFileService, ILogger<ContentTypeController>, IContentService, IContentTypeBaseServiceProvider, IHostingEnvironment, EditorValidatorCollection, PackageDataInstallation, BlockGridSampleHelper)

[Obsolete("Please use constructor that takes an ICoreScopeProvider")]
public ContentTypeController(ICultureDictionary cultureDictionary, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, IUmbracoMapper umbracoMapper, ILocalizedTextService localizedTextService, IEntityXmlSerializer serializer, PropertyEditorCollection propertyEditors, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IDataTypeService dataTypeService, IShortStringHelper shortStringHelper, IFileService fileService, ILogger<ContentTypeController> logger, IContentService contentService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IHostingEnvironment hostingEnvironment, EditorValidatorCollection editorValidatorCollection, PackageDataInstallation packageDataInstallation, BlockGridSampleHelper blockGridSampleHelper)

Parameters

cultureDictionary ICultureDictionary
contentTypeService IContentTypeService
mediaTypeService IMediaTypeService
memberTypeService IMemberTypeService
umbracoMapper IUmbracoMapper
localizedTextService ILocalizedTextService
serializer IEntityXmlSerializer
propertyEditors PropertyEditorCollection
backofficeSecurityAccessor IBackOfficeSecurityAccessor
dataTypeService IDataTypeService
shortStringHelper IShortStringHelper
fileService IFileService
logger ILogger<ContentTypeController>
contentService IContentService
contentTypeBaseServiceProvider IContentTypeBaseServiceProvider
hostingEnvironment IHostingEnvironment
editorValidatorCollection EditorValidatorCollection
packageDataInstallation PackageDataInstallation
blockGridSampleHelper BlockGridSampleHelper

ContentTypeController(ICultureDictionary, IContentTypeService, IMediaTypeService, IMemberTypeService, IUmbracoMapper, ILocalizedTextService, IEntityXmlSerializer, PropertyEditorCollection, IBackOfficeSecurityAccessor, IDataTypeService, IShortStringHelper, IFileService, ILogger<ContentTypeController>, IContentService, IContentTypeBaseServiceProvider, IHostingEnvironment, EditorValidatorCollection, PackageDataInstallation, BlockGridSampleHelper, ICoreScopeProvider)

[ActivatorUtilitiesConstructor]
public ContentTypeController(ICultureDictionary cultureDictionary, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, IUmbracoMapper umbracoMapper, ILocalizedTextService localizedTextService, IEntityXmlSerializer serializer, PropertyEditorCollection propertyEditors, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IDataTypeService dataTypeService, IShortStringHelper shortStringHelper, IFileService fileService, ILogger<ContentTypeController> logger, IContentService contentService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IHostingEnvironment hostingEnvironment, EditorValidatorCollection editorValidatorCollection, PackageDataInstallation packageDataInstallation, BlockGridSampleHelper blockGridSampleHelper, ICoreScopeProvider coreScopeProvider)

Parameters

cultureDictionary ICultureDictionary
contentTypeService IContentTypeService
mediaTypeService IMediaTypeService
memberTypeService IMemberTypeService
umbracoMapper IUmbracoMapper
localizedTextService ILocalizedTextService
serializer IEntityXmlSerializer
propertyEditors PropertyEditorCollection
backofficeSecurityAccessor IBackOfficeSecurityAccessor
dataTypeService IDataTypeService
shortStringHelper IShortStringHelper
fileService IFileService
logger ILogger<ContentTypeController>
contentService IContentService
contentTypeBaseServiceProvider IContentTypeBaseServiceProvider
hostingEnvironment IHostingEnvironment
editorValidatorCollection EditorValidatorCollection
packageDataInstallation PackageDataInstallation
blockGridSampleHelper BlockGridSampleHelper
coreScopeProvider ICoreScopeProvider

Methods

AllowsCultureVariation()

Returns true if any content types have culture variation enabled

[HttpGet]
[Authorize(Policy = "BackOfficeAccess")]
public bool AllowsCultureVariation()

Returns

bool

DeleteById(int)

Deletes a document type with a given ID

[HttpDelete]
[HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult DeleteById(int id)

Parameters

id int

Returns

IActionResult

DeleteContainer(int)

Deletes a document type container with a given ID

[HttpDelete]
[HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult DeleteContainer(int id)

Parameters

id int

Returns

IActionResult

Export(int)

[HttpGet]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult Export(int id)

Parameters

id int

Returns

IActionResult

GetAll()

Returns all content type objects

[Authorize(Policy = "TreeAccessDocumentsOrDocumentTypes")]
public IEnumerable<ContentTypeBasic> GetAll()

Returns

IEnumerable<ContentTypeBasic>

GetAllPropertyTypeAliases()

Gets all user defined properties.

[Authorize(Policy = "TreeAccessAnyContentOrTypes")]
public IEnumerable<string> GetAllPropertyTypeAliases()

Returns

IEnumerable<string>

GetAllStandardFields()

Gets all the standard fields.

[Authorize(Policy = "TreeAccessAnyContentOrTypes")]
public IEnumerable<string> GetAllStandardFields()

Returns

IEnumerable<string>

GetAllowedChildren(int)

Returns the allowed child content type objects for the content item id passed in

[Authorize(Policy = "TreeAccessDocumentsOrDocumentTypes")]
public IEnumerable<ContentTypeBasic> GetAllowedChildren(int contentId)

Parameters

contentId int

Returns

IEnumerable<ContentTypeBasic>

GetAvailableCompositeContentTypes(GetAvailableCompositionsFilter)

Returns the available compositions for this content type This has been wrapped in a dto instead of simple parameters to support having multiple parameters in post request body

[HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult GetAvailableCompositeContentTypes(GetAvailableCompositionsFilter filter)

Parameters

filter GetAvailableCompositionsFilter

Returns

ActionResult

GetById(Guid)

Gets the document type a given guid

[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<DocumentTypeDisplay?> GetById(Guid id)

Parameters

id Guid

Returns

ActionResult<DocumentTypeDisplay>

GetById(int)

Gets the document type a given id

[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<DocumentTypeDisplay?> GetById(int id)

Parameters

id int

Returns

ActionResult<DocumentTypeDisplay>

GetById(Udi)

Gets the document type a given udi

[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<DocumentTypeDisplay?> GetById(Udi id)

Parameters

id Udi

Returns

ActionResult<DocumentTypeDisplay>

GetCount()

[Authorize(Policy = "TreeAccessDocumentTypes")]
public int GetCount()

Returns

int

GetEmpty(int)

Returns an empty content type for use as a scaffold when creating a new type

[Authorize(Policy = "TreeAccessDocumentTypes")]
public DocumentTypeDisplay? GetEmpty(int parentId)

Parameters

parentId int

Returns

DocumentTypeDisplay

GetPropertyTypeScaffold(int)

[Authorize(Policy = "TreeAccessAnyContentOrTypes")]
public ActionResult<ContentPropertyDisplay> GetPropertyTypeScaffold(int id)

Parameters

id int

Returns

ActionResult<ContentPropertyDisplay>

GetWhereCompositionIsUsedInContentTypes(GetAvailableCompositionsFilter)

Returns where a particular composition has been used This has been wrapped in a dto instead of simple parameters to support having multiple parameters in post request body

[HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult GetWhereCompositionIsUsedInContentTypes(GetAvailableCompositionsFilter filter)

Parameters

filter GetAvailableCompositionsFilter

Returns

IActionResult

HasContentNodes(int)

[HttpGet]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public bool HasContentNodes(int id)

Parameters

id int

Returns

bool

Import(string)

[HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult Import(string file)

Parameters

file string

Returns

IActionResult

PostCopy(MoveOrCopy)

Copy the content type

[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult PostCopy(MoveOrCopy copy)

Parameters

copy MoveOrCopy

Returns

IActionResult

PostCreateBlockGridSample()

[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult PostCreateBlockGridSample()

Returns

ActionResult

PostCreateContainer(int, string)

[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult PostCreateContainer(int parentId, string name)

Parameters

parentId int
name string

Returns

IActionResult

PostCreateDefaultTemplate(int)

[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<TemplateDisplay?> PostCreateDefaultTemplate(int id)

Parameters

id int

Returns

ActionResult<TemplateDisplay>

PostMove(MoveOrCopy)

Move the content type

[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult PostMove(MoveOrCopy move)

Parameters

move MoveOrCopy

Returns

IActionResult

PostRenameContainer(int, string)

[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult PostRenameContainer(int id, string name)

Parameters

id int
name string

Returns

IActionResult

PostSave(DocumentTypeSave)

[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<DocumentTypeDisplay?> PostSave(DocumentTypeSave contentTypeSave)

Parameters

contentTypeSave DocumentTypeSave

Returns

ActionResult<DocumentTypeDisplay>

Upload(List<IFormFile>)

[HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<ContentTypeImportModel> Upload(List<IFormFile> file)

Parameters

file List<IFormFile>

Returns

ActionResult<ContentTypeImportModel>