Insights

Enable Versioning For Sitecore Media Items

Enable Versioning For Media In Sitecore

When it comes to versioning in Sitecore there are some things that are obvious, and some things that are not. You can, at any time, add a version for an item from within Content Editor, selecting the Versions tab and clicking Add. Removing a version is equally as easy by clicking the Remove button.

When it comes to Media items, you can create versions as well. There is a key difference however as Media items come in two flavours, Versioned and Unversioned. By default, whenever you upload a media item it will be identified as Unversioned. It is, however, just a Sitecore item so versions can still be applied.

Upload Versionable Through Advanced Menu Option

If you want to upload a media item and make it versionable, then you can use the Upload files (advanced) option.

Screenshot of the media library item in Sitecore

You can then select Make uploaded media items versionable.

Screenshot of creating media items versionable in in Sitecore

Enabling Media Versioning By Default

Let's say we want to make it such that media items are not only versioned by default but that they have a workflow attached, to maintain the versioning rather than just require the user to Add a new version.

Create A Patch Config

The easiest way to force media versioning is through the use of a config patch file, such as the one below that changes Media.UploadAsVersionableByDefault.

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
    <settings>
        <setting name="Media.UploadAsVersionableByDefault" value="false">
        <patch:attribute name="value">true</patch:attribute>
        </setting>
    </settings>
    </sitecore>
</configuration>

Now when you upload a file normally, it will automatically be assigned as Versioned.

If you desired to add a workflow to an appropriate type or media items as a whole, you would then assign it to one of the Versioned templates listed below. Each type inherits from File.

Screenshot of creating different versions of an item in Sitecore

👋 Hey Sitecore Enthusiasts!

Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.

What’s in it for you?

  • Stay up-to-date with the latest Sitecore news
  • New to Sitecore? Learn tips and tricks to help you navigate this powerful tool
  • Sitecore pro? Expand your skill set and discover troubleshooting tips
  • Browse open careers and opportunities
  • Get a chance to be featured in upcoming editions
  • Learn our secret handshake
  • And more!
Sitecore Snack a newsletter by Fishtank Consulting
 

Meet David Austin

Development Team Lead | Sitecore Technology MVP x 3

📷🕹️👪

David is a decorated Development Team Lead with Sitecore Technology MVP and Coveo MVP awards, as well as Sitecore CDP & Personalize Certified. He's worked in IT for 25 years; everything ranging from Developer to Business Analyst to Group Lead helping manage everything from Intranet and Internet sites to facility management and application support. David is a dedicated family man who loves to spend time with his girls. He's also an avid photographer and loves to explore new places.

Connect with David