View Source
Inheritance
System.Object
Assembly: Umbraco.Web.dll
[PluginController("UmbracoApi")]
public class MediaController : ContentControllerBase, IDiscoverable
Constructors
View Source
MediaController(PropertyEditorCollection, IGlobalSettings, IUmbracoContextAccessor, ISqlContext, ServiceContext, AppCaches, IProfilingLogger, IRuntimeState, UmbracoHelper)
Declaration
public MediaController(PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
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
public HttpResponseMessage DeleteById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
HttpResponseMessage |
|
View Source
Declaration
public HttpResponseMessage EmptyRecycleBin()
Returns
Type |
Description |
HttpResponseMessage |
|
View Source
Gets the media item by id
Declaration
public MediaItemDisplay GetById(Guid id)
Parameters
Type |
Name |
Description |
System.Guid |
id |
|
Returns
View Source
Gets the media item by id
Declaration
public MediaItemDisplay GetById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
Gets the media item by id
Declaration
public MediaItemDisplay GetById(Udi id)
Parameters
Type |
Name |
Description |
Udi |
id |
|
Returns
View Source
Return media for the specified ids
Declaration
public IEnumerable<MediaItemDisplay> GetByIds(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 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 |
System.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 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 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()
Used to submit a media file
Declaration
public async Task<HttpResponseMessage> PostAddFile()
Returns
Type |
Description |
System.Threading.Tasks.Task<HttpResponseMessage> |
|
View Source
PostAddFolder(PostedFolder)
Declaration
public MediaItemDisplay PostAddFolder(PostedFolder folder)
Parameters
Returns
View Source
PostMove(MoveOrCopy)
Change the sort order for media
Declaration
public HttpResponseMessage PostMove(MoveOrCopy move)
Parameters
Returns
Type |
Description |
HttpResponseMessage |
|
View Source
PostSave(MediaItemSave)
Declaration
public MediaItemDisplay PostSave(MediaItemSave contentItem)
Parameters
Returns
View Source
PostSort(ContentSortOrder)
Change the sort order for media
Declaration
public HttpResponseMessage PostSort(ContentSortOrder sorted)
Parameters
Returns
Type |
Description |
HttpResponseMessage |
|