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
Hi,
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?
TIA Marco
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
https://gist.github.com/minirobbo/378a644aed6089d69f787c747b8da757
Thanks! 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):
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using Umbraco.Core; @using Umbraco.Core.Logging; @using Umbraco.Core.Models; @using Umbraco.Core.Services; @{ Layout = null; IMediaService mediaService = ApplicationContext.Current.Services.MediaService; IContentTypeService contentTypeService = ApplicationContext.Current.Services.ContentTypeService; IMediaType fileMediaType = contentTypeService.GetMediaType("File"); } <html> <head> <title>Media Type changer</title> </head> <body> <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) { file.ChangeContentType(fileMediaType); mediaService.Save(file); cnt++; <p>@cnt/@filesToConvert.Count() - @file.Name converted to @fileMediaType.Name</p> } } </body> </html>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Uninstall package and Media Types
Hi,
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?
TIA Marco
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
https://gist.github.com/minirobbo/378a644aed6089d69f787c747b8da757
Thanks! 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):
is working on a reply...