View Source
  Class ContentTypeController
  
  An API controller used for dealing with content types
 
  
  
    Inheritance
      System.Object
      Microsoft.AspNetCore.Mvc.ControllerBase
      
      
      
      
      
      
      
   
  
  Assembly: Umbraco.Web.BackOffice.dll
  Syntax
  
    public class ContentTypeController : ContentTypeControllerBase<IContentType>
   
  Constructors
  
  
    View Source
  
  ContentTypeController(ICultureDictionary, IContentTypeService, IMediaTypeService, IMemberTypeService, IUmbracoMapper, ILocalizedTextService, IEntityXmlSerializer, PropertyEditorCollection, IBackOfficeSecurityAccessor, IDataTypeService, IShortStringHelper, IFileService, ILogger<ContentTypeController>, IContentService, IContentTypeBaseServiceProvider, IHostingEnvironment, EditorValidatorCollection, PackageDataInstallation)
  
  
  Declaration
  
    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
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | ICultureDictionary | 
        cultureDictionary | 
         | 
      
      
        | IContentTypeService | 
        contentTypeService | 
         | 
      
      
        | IMediaTypeService | 
        mediaTypeService | 
         | 
      
      
        | IMemberTypeService | 
        memberTypeService | 
         | 
      
      
        | IUmbracoMapper | 
        umbracoMapper | 
         | 
      
      
        | ILocalizedTextService | 
        localizedTextService | 
         | 
      
      
        | IEntityXmlSerializer | 
        serializer | 
         | 
      
      
        | PropertyEditorCollection | 
        propertyEditors | 
         | 
      
      
        | IBackOfficeSecurityAccessor | 
        backofficeSecurityAccessor | 
         | 
      
      
        | IDataTypeService | 
        dataTypeService | 
         | 
      
      
        | IShortStringHelper | 
        shortStringHelper | 
         | 
      
      
        | IFileService | 
        fileService | 
         | 
      
      
        | Microsoft.Extensions.Logging.ILogger<ContentTypeController> | 
        logger | 
         | 
      
      
        | IContentService | 
        contentService | 
         | 
      
      
        | IContentTypeBaseServiceProvider | 
        contentTypeBaseServiceProvider | 
         | 
      
      
        | IHostingEnvironment | 
        hostingEnvironment | 
         | 
      
      
        | EditorValidatorCollection | 
        editorValidatorCollection | 
         | 
      
      
        | PackageDataInstallation | 
        packageDataInstallation | 
         | 
      
    
  
  
    View Source
  
  ContentTypeController(ICultureDictionary, IContentTypeService, IMediaTypeService, IMemberTypeService, IUmbracoMapper, ILocalizedTextService, IEntityXmlSerializer, PropertyEditorCollection, IBackOfficeSecurityAccessor, IDataTypeService, IShortStringHelper, IFileService, ILogger<ContentTypeController>, IContentService, IContentTypeBaseServiceProvider, IHostingEnvironment, EditorValidatorCollection, PackageDataInstallation, BlockGridSampleHelper)
  
  
  Declaration
  
    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
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | ICultureDictionary | 
        cultureDictionary | 
         | 
      
      
        | IContentTypeService | 
        contentTypeService | 
         | 
      
      
        | IMediaTypeService | 
        mediaTypeService | 
         | 
      
      
        | IMemberTypeService | 
        memberTypeService | 
         | 
      
      
        | IUmbracoMapper | 
        umbracoMapper | 
         | 
      
      
        | ILocalizedTextService | 
        localizedTextService | 
         | 
      
      
        | IEntityXmlSerializer | 
        serializer | 
         | 
      
      
        | PropertyEditorCollection | 
        propertyEditors | 
         | 
      
      
        | IBackOfficeSecurityAccessor | 
        backofficeSecurityAccessor | 
         | 
      
      
        | IDataTypeService | 
        dataTypeService | 
         | 
      
      
        | IShortStringHelper | 
        shortStringHelper | 
         | 
      
      
        | IFileService | 
        fileService | 
         | 
      
      
        | Microsoft.Extensions.Logging.ILogger<ContentTypeController> | 
        logger | 
         | 
      
      
        | IContentService | 
        contentService | 
         | 
      
      
        | IContentTypeBaseServiceProvider | 
        contentTypeBaseServiceProvider | 
         | 
      
      
        | IHostingEnvironment | 
        hostingEnvironment | 
         | 
      
      
        | EditorValidatorCollection | 
        editorValidatorCollection | 
         | 
      
      
        | PackageDataInstallation | 
        packageDataInstallation | 
         | 
      
      
        | BlockGridSampleHelper | 
        blockGridSampleHelper | 
         | 
      
    
  
  
    View Source
  
  ContentTypeController(ICultureDictionary, IContentTypeService, IMediaTypeService, IMemberTypeService, IUmbracoMapper, ILocalizedTextService, IEntityXmlSerializer, PropertyEditorCollection, IBackOfficeSecurityAccessor, IDataTypeService, IShortStringHelper, IFileService, ILogger<ContentTypeController>, IContentService, IContentTypeBaseServiceProvider, IHostingEnvironment, EditorValidatorCollection, PackageDataInstallation, BlockGridSampleHelper, ICoreScopeProvider)
  
  
  Declaration
  
    [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
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | ICultureDictionary | 
        cultureDictionary | 
         | 
      
      
        | IContentTypeService | 
        contentTypeService | 
         | 
      
      
        | IMediaTypeService | 
        mediaTypeService | 
         | 
      
      
        | IMemberTypeService | 
        memberTypeService | 
         | 
      
      
        | IUmbracoMapper | 
        umbracoMapper | 
         | 
      
      
        | ILocalizedTextService | 
        localizedTextService | 
         | 
      
      
        | IEntityXmlSerializer | 
        serializer | 
         | 
      
      
        | PropertyEditorCollection | 
        propertyEditors | 
         | 
      
      
        | IBackOfficeSecurityAccessor | 
        backofficeSecurityAccessor | 
         | 
      
      
        | IDataTypeService | 
        dataTypeService | 
         | 
      
      
        | IShortStringHelper | 
        shortStringHelper | 
         | 
      
      
        | IFileService | 
        fileService | 
         | 
      
      
        | Microsoft.Extensions.Logging.ILogger<ContentTypeController> | 
        logger | 
         | 
      
      
        | IContentService | 
        contentService | 
         | 
      
      
        | IContentTypeBaseServiceProvider | 
        contentTypeBaseServiceProvider | 
         | 
      
      
        | IHostingEnvironment | 
        hostingEnvironment | 
         | 
      
      
        | EditorValidatorCollection | 
        editorValidatorCollection | 
         | 
      
      
        | PackageDataInstallation | 
        packageDataInstallation | 
         | 
      
      
        | BlockGridSampleHelper | 
        blockGridSampleHelper | 
         | 
      
      
        | ICoreScopeProvider | 
        coreScopeProvider | 
         | 
      
    
  
  Methods
  
  
    View Source
  
  AllowsCultureVariation()
  Returns true if any content types have culture variation enabled
 
  
  Declaration
  
    [HttpGet]
[Authorize(Policy = "BackOfficeAccess")]
public bool AllowsCultureVariation()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  DeleteById(Int32)
  Deletes a document type with a given ID
 
  
  Declaration
  
    [HttpDelete]
[HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult DeleteById(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  DeleteContainer(Int32)
  Deletes a document type container with a given ID
 
  
  Declaration
  
    [HttpDelete]
[HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult DeleteContainer(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  Export(Int32)
  
  
  Declaration
  
    [HttpGet]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult Export(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  GetAll()
  Returns all content type objects
 
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentsOrDocumentTypes")]
public IEnumerable<ContentTypeBasic> GetAll()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | IEnumerable<ContentTypeBasic> | 
         | 
      
    
  
  
    View Source
  
  GetAllowedChildren(Int32)
  Returns the allowed child content type objects for the content item id passed in
 
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentsOrDocumentTypes")]
public IEnumerable<ContentTypeBasic> GetAllowedChildren(int contentId)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        contentId | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | IEnumerable<ContentTypeBasic> | 
         | 
      
    
  
  
    View Source
  
  GetAllPropertyTypeAliases()
  Gets all user defined properties.
 
  
  Declaration
  
    [Authorize(Policy = "TreeAccessAnyContentOrTypes")]
public IEnumerable<string> GetAllPropertyTypeAliases()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | IEnumerable<System.String> | 
         | 
      
    
  
  
    View Source
  
  GetAllStandardFields()
  Gets all the standard fields.
 
  
  Declaration
  
    [Authorize(Policy = "TreeAccessAnyContentOrTypes")]
public IEnumerable<string> GetAllStandardFields()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | IEnumerable<System.String> | 
         | 
      
    
  
  
    View Source
  
  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
 
  
  Declaration
  
    [HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult GetAvailableCompositeContentTypes(GetAvailableCompositionsFilter filter)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | GetAvailableCompositionsFilter | 
        filter | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult | 
         | 
      
    
  
  
    View Source
  
  GetById(Guid)
  Gets the document type a given guid
 
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<DocumentTypeDisplay?> GetById(Guid id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Guid | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DocumentTypeDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetById(Int32)
  Gets the document type a given id
 
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<DocumentTypeDisplay?> GetById(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DocumentTypeDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetById(Udi)
  Gets the document type a given udi
 
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<DocumentTypeDisplay?> GetById(Udi id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | Udi | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DocumentTypeDisplay>> | 
         | 
      
    
  
  
    View Source
  
  GetCount()
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public int GetCount()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Int32 | 
         | 
      
    
  
  
    View Source
  
  GetEmpty(Int32)
  Returns an empty content type for use as a scaffold when creating a new type
 
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public DocumentTypeDisplay? GetEmpty(int parentId)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        parentId | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Nullable<DocumentTypeDisplay> | 
         | 
      
    
  
  
    View Source
  
  GetPropertyTypeScaffold(Int32)
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessAnyContentOrTypes")]
public ActionResult<ContentPropertyDisplay> GetPropertyTypeScaffold(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<ContentPropertyDisplay> | 
         | 
      
    
  
  
    View Source
  
  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
 
  
  Declaration
  
    [HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult GetWhereCompositionIsUsedInContentTypes(GetAvailableCompositionsFilter filter)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | GetAvailableCompositionsFilter | 
        filter | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  HasContentNodes(Int32)
  
  
  Declaration
  
    [HttpGet]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public bool HasContentNodes(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  Import(String)
  
  
  Declaration
  
    [HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult Import(string file)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        file | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostCopy(MoveOrCopy)
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult PostCopy(MoveOrCopy copy)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | MoveOrCopy | 
        copy | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostCreateBlockGridSample()
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult PostCreateBlockGridSample()
   
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult | 
         | 
      
    
  
  
    View Source
  
  PostCreateContainer(Int32, String)
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult PostCreateContainer(int parentId, string name)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        parentId | 
         | 
      
      
        | System.String | 
        name | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostCreateDefaultTemplate(Int32)
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<TemplateDisplay?> PostCreateDefaultTemplate(int id)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<TemplateDisplay>> | 
         | 
      
    
  
  
    View Source
  
  PostMove(MoveOrCopy)
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult PostMove(MoveOrCopy move)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | MoveOrCopy | 
        move | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostRenameContainer(Int32, String)
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public IActionResult PostRenameContainer(int id, string name)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Int32 | 
        id | 
         | 
      
      
        | System.String | 
        name | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.IActionResult | 
         | 
      
    
  
  
    View Source
  
  PostSave(DocumentTypeSave)
  
  
  Declaration
  
    [Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<DocumentTypeDisplay?> PostSave(DocumentTypeSave contentTypeSave)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | DocumentTypeSave | 
        contentTypeSave | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<System.Nullable<DocumentTypeDisplay>> | 
         | 
      
    
  
  
    View Source
  
  Upload(List<IFormFile>)
  
  
  Declaration
  
    [HttpPost]
[Authorize(Policy = "TreeAccessDocumentTypes")]
public ActionResult<ContentTypeImportModel> Upload(List<IFormFile> file)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | List<Microsoft.AspNetCore.Http.IFormFile> | 
        file | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | Microsoft.AspNetCore.Mvc.ActionResult<ContentTypeImportModel> | 
         |