Each scheme has the AllowedMultimediaTypes property, which returns a list, and the default scheme for multimedia messages is usually configured for all types. If it does not allow all types, then for this purpose you can create a special scheme.
So, all you have to do is get the allowed media types by default media scheme (or your special scheme that allows all types), and then map the entered mime type to the mimetime of each returned MultimediaType.
Here is an example above (not verified):
Schema defaultMMSchema = (Schema)engine.GetObject("Your-Default-MMSchema-WebDav-Path"); IList<MultimediaType> mmTypes = defaultMMSchema.AllowedMultimediaTypes; foreach(MultimediaType mt in mmTypes) { switch(mt.MimeType) { case "jpg": ... } }
Alternatively, the TCM identifiers from the predefined media types are persistent, so you donβt have to worry about them changing after the content is transferred to another environment. Therefore, you can write a class that provides a mime type mapping with the tcm identifier. Note. Itβs not so elegant if you create your own element types, since you will need to update your code with the TCM ID for each Tridion environment.
Nickoli Roussakov
source share