View Source
Inheritance
System.Object
Microsoft.AspNetCore.Mvc.ControllerBase
Assembly: Umbraco.Web.BackOffice.dll
[PluginController("UmbracoApi")]
[Authorize(Policy = "SectionAccessMedia")]
public class MediaController : ContentControllerBase, IUmbracoFeature, IDiscoverable
Constructors
View Source
MediaController(ICultureDictionary, ILoggerFactory, IShortStringHelper, IEventMessagesFactory, ILocalizedTextService, IOptionsSnapshot<ContentSettings>, IMediaTypeService, IMediaService, IEntityService, IBackOfficeSecurityAccessor, IUmbracoMapper, IDataTypeService, ISqlContext, IContentTypeBaseServiceProvider, IRelationService, PropertyEditorCollection, MediaFileManager, MediaUrlGeneratorCollection, IHostingEnvironment, IImageUrlGenerator, IJsonSerializer, IAuthorizationService, AppCaches)
Declaration
public MediaController(ICultureDictionary cultureDictionary, ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper, IEventMessagesFactory eventMessages, ILocalizedTextService localizedTextService, IOptionsSnapshot<ContentSettings> contentSettings, IMediaTypeService mediaTypeService, IMediaService mediaService, IEntityService entityService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IUmbracoMapper umbracoMapper, IDataTypeService dataTypeService, ISqlContext sqlContext, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IRelationService relationService, PropertyEditorCollection propertyEditors, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IHostingEnvironment hostingEnvironment, IImageUrlGenerator imageUrlGenerator, IJsonSerializer serializer, IAuthorizationService authorizationService, AppCaches appCaches)
Parameters
View Source
MediaController(ICultureDictionary, ILoggerFactory, IShortStringHelper, IEventMessagesFactory, ILocalizedTextService, IOptionsSnapshot<ContentSettings>, IMediaTypeService, IMediaService, IEntityService, IBackOfficeSecurityAccessor, IUmbracoMapper, IDataTypeService, ISqlContext, IContentTypeBaseServiceProvider, IRelationService, PropertyEditorCollection, MediaFileManager, MediaUrlGeneratorCollection, IHostingEnvironment, IImageUrlGenerator, IJsonSerializer, IAuthorizationService, AppCaches, IFileStreamSecurityValidator)
Declaration
[ActivatorUtilitiesConstructor]
public MediaController(ICultureDictionary cultureDictionary, ILoggerFactory loggerFactory, IShortStringHelper shortStringHelper, IEventMessagesFactory eventMessages, ILocalizedTextService localizedTextService, IOptionsSnapshot<ContentSettings> contentSettings, IMediaTypeService mediaTypeService, IMediaService mediaService, IEntityService entityService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, IUmbracoMapper umbracoMapper, IDataTypeService dataTypeService, ISqlContext sqlContext, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IRelationService relationService, PropertyEditorCollection propertyEditors, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IHostingEnvironment hostingEnvironment, IImageUrlGenerator imageUrlGenerator, IJsonSerializer serializer, IAuthorizationService authorizationService, AppCaches appCaches, IFileStreamSecurityValidator streamSecurityValidator)
Parameters
Properties
View Source
Declaration
protected int[] UserStartNodes { get; }
Property Value
Type |
Description |
System.Int32[] |
|
Methods
View Source
Moves an item to the recycle bin, if it is already there then it will permanently delete it
Declaration
[Authorize(Policy = "MediaPermissionPathById")]
[HttpPost]
public IActionResult DeleteById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
Declaration
[HttpDelete]
[HttpPost]
public IActionResult EmptyRecycleBin()
Returns
Type |
Description |
Microsoft.AspNetCore.Mvc.IActionResult |
|
View Source
Gets the media item by id
Declaration
[Authorize(Policy = "MediaPermissionPathById")]
public MediaItemDisplay GetById(Guid id)
Parameters
Type |
Name |
Description |
Guid |
id |
|
Returns
View Source
Gets the media item by id
Declaration
[Authorize(Policy = "MediaPermissionPathById")]
public MediaItemDisplay GetById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
Gets the media item by id
Declaration
[Authorize(Policy = "MediaPermissionPathById")]
public ActionResult<MediaItemDisplay> GetById(Udi id)
Parameters
Type |
Name |
Description |
Udi |
id |
|
Returns
View Source
Return media for the specified ids
Declaration
public IEnumerable<MediaItemDisplay> GetByIds([FromQuery] int[] ids)
Parameters
Type |
Name |
Description |
System.Int32[] |
ids |
|
Returns
View Source
Returns a paged result of media items known to be of a "Folder" type
Declaration
public PagedResult<ContentItemBasic<ContentPropertyBasic>> GetChildFolders(int id, int pageNumber = 1, int pageSize = 1000)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
Returns
View Source
Returns the child media objects - using the entity GUID id
Declaration
public ActionResult<PagedResult<ContentItemBasic<ContentPropertyBasic>>> GetChildren(Guid id, int pageNumber = 0, int pageSize = 0, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "")
Parameters
Type |
Name |
Description |
Guid |
id |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
System.Boolean |
orderBySystemField |
|
System.String |
filter |
|
Returns
View Source
Returns the child media objects - using the entity INT id
Declaration
public PagedResult<ContentItemBasic<ContentPropertyBasic>> GetChildren(int id, int pageNumber = 0, int pageSize = 0, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "")
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
System.Boolean |
orderBySystemField |
|
System.String |
filter |
|
Returns
View Source
Returns the child media objects - using the entity UDI id
Declaration
public ActionResult<PagedResult<ContentItemBasic<ContentPropertyBasic>>> GetChildren(Udi id, int pageNumber = 0, int pageSize = 0, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "")
Parameters
Type |
Name |
Description |
Udi |
id |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
System.String |
orderBy |
|
Direction |
orderDirection |
|
System.Boolean |
orderBySystemField |
|
System.String |
filter |
|
Returns
View Source
Gets an empty content item for the
Declaration
public ActionResult<MediaItemDisplay> GetEmpty(string contentTypeAlias, int parentId)
Parameters
Type |
Name |
Description |
System.String |
contentTypeAlias |
|
System.Int32 |
parentId |
|
Returns
View Source
GetPagedReferences(Int32, String, Int32, Int32)
Declaration
public PagedResult<EntityBasic> GetPagedReferences(int id, string entityType, int pageNumber = 1, int pageSize = 100)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.String |
entityType |
|
System.Int32 |
pageNumber |
|
System.Int32 |
pageSize |
|
Returns
View Source
Returns an item to be used to display the recycle bin for media
Declaration
public MediaItemDisplay GetRecycleBin()
Returns
View Source
Returns the root media objects
Declaration
public IEnumerable<ContentItemBasic<ContentPropertyBasic>> GetRootMedia()
Returns
View Source
PostAddFile(String, String, String, List<IFormFile>)
Used to submit a media file
Declaration
public async Task<IActionResult> PostAddFile([FromForm] string path, [FromForm] string currentFolder, [FromForm] string contentTypeAlias, List<IFormFile> file)
Parameters
Type |
Name |
Description |
System.String |
path |
|
System.String |
currentFolder |
|
System.String |
contentTypeAlias |
|
List<Microsoft.AspNetCore.Http.IFormFile> |
file |
|
Returns
Type |
Description |
Task<Microsoft.AspNetCore.Mvc.IActionResult> |
|
View Source
PostAddFolder(PostedFolder)
Declaration
public async Task<ActionResult<MediaItemDisplay>> PostAddFolder(PostedFolder folder)
Parameters
Returns
View Source
PostMove(MoveOrCopy)
Change the sort order for media
Declaration
public async Task<IActionResult> PostMove(MoveOrCopy move)
Parameters
Returns
Type |
Description |
Task<Microsoft.AspNetCore.Mvc.IActionResult> |
|
View Source
PostSave(MediaItemSave)
Declaration
[FileUploadCleanupFilter(true)]
public ActionResult<MediaItemDisplay> PostSave([ModelBinder(typeof(MediaItemBinder))] MediaItemSave contentItem)
Parameters
Returns
View Source
PostSort(ContentSortOrder)
Change the sort order for media
Declaration
public async Task<IActionResult> PostSort(ContentSortOrder sorted)
Parameters
Returns
Type |
Description |
Task<Microsoft.AspNetCore.Mvc.IActionResult> |
|