I'm using the EPiServer.DataAbstraction.PageVersion.List method to get a list of versions of a particular page:
PageVersionCollection pageVersions = EPiServer.DataAbstraction.PageVersion.List(pageData.PageLink, pageData.LanguageBranch);
As you can see, I use the overload that takes a language branch too, so I only get back versions of the specified language branch.
After looking at the PageVersionCollection that is returned by this method, I have made two assumptions:
Can someone please confirm or deny the correctness of my assumptions?
I just did a quick test and I got all versions regardless if they were published or not. Just like the SDK says. The list had the first version first and the newest version last, so that assumption is correct.
Many thanks for your reply Tobias. I'm a little surprised then, that I only get Published or PreviouslyPublished pages.
If I make an edit to a page in the CMS and then click 'Save and View', should that not create a new version of a page? Or do I have to click 'Ready to Publish' for that to happen? I will try it.
At least I can be fairly sure that the list is always in chronological order.
It should return every version you see in the Versions tab. So, yes when you save a page a new version is created.
Ok, I've just figured it out. If I save a page, and there was a previously *un*published version, then the new save will overwrite the older version. Likewise for publishing, it overwrites the last unpublished version. Thus, I only seem to get a list of published or previously published versions in my version list. Is this normal EPiServer behaviour?
Not quite. Do this:
1. Begin editing a page, then save it. You now have 1 version saved2. Go to another page and then back to the first page. You will see the last published version.3. Edit the page and click save. Now you have 2 versions saved.4. If you now publish this version then you have 1 version that is saved and last in the list you would have the version you just published.
Ok, so if you stay on the same page between edits, then it counts them all as one version.