Link to old media content version

Vote:
 

Hello,

I was looking into with generating a list to show the version history of files in Episerver, which is no problem with the IContentVersionRepository.

My problem though is to generate the download links for the files that have older versions. Even if I send the ContentVersion.ContentLink to the UrlResolver I still get the url for the latest version of the file.

Also, if I select an older version in the Version gadget for the file all the links in Episerver still points to the latest version of the file.

So, is this possible out of the box in Episerver? I know I could build some http handler and return the stream of the old blob, but wanted to this the "standard" way if there is any.

// Christopher

#176138
Mar 10, 2017 11:46
Vote:
 

Not sure this is possible since the actual file is not versioned if I am correct!? It is the IContent that is versioned and not the file it self so you will need to get the binary data for the old version somhow. 

I found this thread that has your problem as well. Maybe it can assist?

http://world.episerver.com/forum/developer-forum/-EPiServer-75-CMS/Thread-Container/2016/1/how-can-i-access-versioning-media-files-i-episerver-cms-8/

#176212
Mar 13, 2017 22:37
Vote:
 

Yeah, I tested so far that I can get the blob of the older version of the file and open a stream to it.

Mostly wanted to know if there is a built in way to access the older versions.

#176255
Mar 14, 2017 15:15
Vote:
 

No as far as i know it is not any specific api for this at the moment from epi.

#176278
Mar 14, 2017 21:25
Vote:
 

I solved it by creating a partial router for a content version, which allows older versions to be downloaded with URLs like "/globalassets/file.txt/X" where X is the WorkID version on the ContentReference.

For anyone else which might need this the code was added to github: https://github.com/trembon/EPiServer.CJansson.MediaDataVersionRouter

#176289
Mar 15, 2017 8:19
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.