This tip is from one of my colleagues Frederik Örnfelt who read my post about Adding a file to the Sitecore Media Library. But instead of adding files, he simply wanted to replace one item with another. Replacing media items is also done using the Sitecore MediaManager and a little stream magic:
Media sourceMedia = MediaManager.GetMedia(_sourceMediaItem); Media targetMedia = MediaManager.GetMedia(mediaItem); targetMedia.SetStream(sourceMedia.GetStream());
Thanks Frederik. And happy easter.
