Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to uninstall the package and remove the media types that it creates from a production site.
Is there a way to change media created as type File-Word, File-Pdf, etc. to the standard File type without other side effects?
Hi Marco, it seemed like a great idea at the time, but since then umbraco killed off the ability to access child media types
here is a Gits that will set the mediatypes back to "File" when you save a media type
I used your example as a basis for a template that changes each media of type File-xxx to File (to be run after the package is uninstalled):
Layout = null;
IMediaService mediaService = ApplicationContext.Current.Services.MediaService;
IContentTypeService contentTypeService = ApplicationContext.Current.Services.ContentTypeService;
IMediaType fileMediaType = contentTypeService.GetMediaType("File");
<title>Media Type changer</title>
<h1>Convert File children types to File type</h1>
@foreach (IMediaType subFileType in contentTypeService.GetMediaTypeChildren(fileMediaType.Id))
<h2>Converting @subFileType.Name to @fileMediaType.Name</h2>
IEnumerable<IMedia> filesToConvert = mediaService.GetMediaOfMediaType(subFileType.Id);
int cnt = 0;
foreach (IMedia file in filesToConvert)
<p>@cnt/@filesToConvert.Count() - @file.Name converted to @fileMediaType.Name</p>
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted