Try our conversational search powered by Generative AI!

Link to old media content version



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

Mar 10, 2017 11:46

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?

Mar 13, 2017 22:37

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.

Mar 14, 2017 15:15

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

Mar 14, 2017 21:25

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:

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.