Sitecore.Resources.Media.MediaCreator删除媒体版本 [英] Sitecore.Resources.Media.MediaCreator deletes versions of media

查看:93
本文介绍了Sitecore.Resources.Media.MediaCreator删除媒体版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用"Sitecore.Resources.Media.MediaCreator"和"CreateFromStream"功能将图像添加到媒体库. 一切似乎都正常,除了每次我将新图像添加到已存在的图像项中时,旧图像都被覆盖,我想创建一个新版本,然后将新图像添加到新版本中,同时保留旧版本和图像.图片应基于未转换"模板,因为图片在语言之间共享.

I am adding images to the Media Library using the "Sitecore.Resources.Media.MediaCreator" and the "CreateFromStream"-function. Everything seems to work fine except that everytime I add a new image to an already existing image item the old image is overwritten, I would like to create a new version instead and add the new image to the new version, keeping the old version and image. The images should be based on an "unversioned" template as images are shared between languages.

在添加新媒体之前,我曾尝试以编程方式添加新版本,但是在运行CreateFromStream()之后会删除新版本.

I have tried programmatically adding a new version prior to adding new media but the new version is deleted after running CreateFromStream().

我也尝试了不同的MediaCreatorOptions"Versioned"和"KeepExisting",但这对我没有帮助.

I have also tried the different MediaCreatorOptions "Versioned" and "KeepExisting" but it doesn't help me.

可以使用SheerUI做到这一点,所以我想应该可以.

It is possible to do this using SheerUI so I guess it should be possible.

我将非常感谢您的帮助.

I would really appreciate any help.

推荐答案

我想我解决了.

Media media = MediaManager.GetMedia(myOldMediaItem);
media.SetStream(memoryStream, extension);

此代码不会删除任何以前的版本,当然,我需要在此之前添加新版本.

This code does not delete any previous versions, off course I need to add the new versions before.

这篇关于Sitecore.Resources.Media.MediaCreator删除媒体版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆