0

How to get the specific version of media item in Sitecore 9.1?

I tried the following url http://hostname/~/media/mediaitem.aspx?vs=1. But it is not working, still getting the latest version of Sitecore media item.

Any help is much appreciated.

3

I guess you are trying to access an image from your published DB [not master] with the URL. So whatever version number you pass in "vs", the published DB will always have only one version and whenever you access the image URL, it shows the same image/version all the time.

If you want to access multiple versions available in your master DB then first you need to check the option "Make uploaded media items versionable" when uploading the media/image item. If you check that then you could able to upload different images in each version and retrieve all the versions by passing "vs" querystring. But this can be done only when you access the image from master DB. Again if it is "web" db you see only one version all the time.

If you have a specific query/question regarding the media URL/versioning then update your question.

| improve this answer | |
  • Hi Gobinath, Thanks for your suggestion on this. Yes I am not referring to master DB. Now i changed the reference to MasterDB and changed the "Media.UploadAsVersionableByDefault" to true in sitecore.config file... But still image shows the latest version. Let me know if I am missing anything... – Naga Dinesh May 7 '19 at 7:06
  • after changing the reference to master DB, the media url has changed to hostname/~/media/mediaitem.aspx?db=master&vs=1 – Naga Dinesh May 7 '19 at 7:20
  • What happens when you preview the specific version, URL will be hostname/sitecore/shell/Applications/-/media{itemID}.ashx?db=master&la=en&vs=1. Or you can preview from Media-> View – Gobinath Saminathan May 8 '19 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.