How to get data from ContentVersion?


Dear EpiServer Team, please help.

I have a page InfoPage with the fields InfoAddress, ....

public class InfoPage : BasePage
        public virtual string InfoAddress { get; set; }

        public virtual string InfoAddress1 { get; set; }

        public virtual string InfoAddress2 { get; set; }


When I save content It's necessary to check, was the field InfoAddress chenged from the last publish?

I found information about how to get the version of the page

 var versionRepository = ServiceLocator.Current.GetInstance<IContentVersionRepository>();
ContentVersion publishedPage = versionRepository.LoadPublished(currentPage.ContentLink);

But how to get the last published version of the field InfoAddress I don't know.

Please, help.

Thank you in advance.


Sep 04, 2013 19:58

I think,  I've found the decision:

var page = repository.Get<InfoPage>(publishedPage.ContentLink) as InfoPage;

var lastval = page.InfoAddress;

Sep 04, 2013 20:10
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.