November Happy Hour will be moved to Thursday December 5th.

Question about EPiServer.DataAbstraction.PageVersion.List

Vote:
 

Hi,

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:

  1. It will only include Published or PreviouslyPublished versions of the specified page (and will not include other versions that were saved but not published)
  2. The list will always be in chronological order, i.e. looking at my line of code above, pageVersions[0] will always return the first published version of the page.

Can someone please confirm or deny the correctness of my assumptions?

Many thanks.

#46628
Dec 21, 2010 18:28
Vote:
 

Hi,

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.

#46631
Dec 22, 2010 8:28
Vote:
 

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.

#46637
Dec 22, 2010 13:01
Vote:
 

It should return every version you see in the Versions tab. So, yes when you save a page a new version is created.

#46639
Dec 22, 2010 13:33
Vote:
 

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?

#46640
Dec 22, 2010 14:46
Vote:
 

Not quite. Do this:

1. Begin editing a page, then save it. You now have 1 version saved
2. 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.

 

#46642
Dec 22, 2010 14:55
Vote:
 

Ok, so if you stay on the same page between edits, then it counts them all as one version.

#46680
Dec 23, 2010 17:14
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.