Try our conversational search powered by Generative AI!

How to get the latest version of at page?

Vote:
 
I need to know how I can get the latest version of a page, it doesnt mather if the latest version is published or not. I just need the absolute latest version.. this is my code today: EPiServer.Global.EPDataFactory.GetPage( new PageReference(id), new LanguageSelector(lang), EPiServer.Security.AccessControlList.NoAccess ); I think I should use one of the overloaded constructors for the the pagereference-object, but I dont understand how they work.
#12744
Aug 18, 2006 10:53
Vote:
 
Have you looked at the static DataAbstraction.PageVersion.List(...)?
#14819
Aug 18, 2006 11:09
Vote:
 
It works fine with the PageVersionCollection: public string GetLatestPageVersionID(string _id, string _lang) { PageVersionCollection pvc = PageVersion.List(new PageReference(_id)); PageVersionCollection pvcLang = new PageVersionCollection(); foreach(PageVersion pv in pvc) { if(pv.LanguageBranch == _lang) pvcLang.Add(pv); } return pvcLang[pvcLang.Count -1].ID.ToString(); } This exampel works with multilanguage.
#14820
Aug 18, 2006 14:17
* 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.