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.
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.