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

Trouble deleting a page version

Vote:
 

Hi, I'm having trouble deleting a version of page.

First I create a page programatically like this:

PageData page = DataFactory.Instance.GetDefaultPageData(CurrentPage.PageLink, "MyPageType"); page.PageName = "MyPage"; DataFactory.Instance.Save(page, EPiServer.DataAccess.SaveAction.Save, AccessLevel.NoAccess);

That works fine. Then I want to change a property of my created page and as I understand it you need to make clone of the page in order to make it writeable.

PageData myClonedPage = myOriginalPage.CreateWritableClone(); myClonedPage.PageName = "MyNewPageName"; DataFactory.Instance.Save(myClonedPage, EPiServer.DataAccess.SaveAction.Save, AccessLevel.NoAccess); 

This creates a new version of the page. Now I want to delete the original version and I try to do it like this. I get no error message but the page version does not get deleted.

PageVersionCollection pvc = DataFactory.Instance.ListVersions(myOriginalPage.PageLink); DataFactory.Instance.DeleteVersion(pvc[0].ID, AccessLevel.NoAccess);

Is the problem that I try to delete the Masterversion or what? Is there another way to change a created page programtically?

Thank you!

 

#27922
Feb 13, 2009 9:58
Vote:
 

I hate to bump my own thread but I really need someone to point me in the right direction with this issue.

 Anyone please?

 Thank you!

#28309
Mar 03, 2009 9:00
Vote:
 

Do you have to save the page before setting the property? if not then you can set the property before you save the page and you'll end up with only one version.

 -Kjetil Simensen

#28321
Mar 03, 2009 13:44
Vote:
 
Yes. The initial page is created when a user fills a form. An email verification is sent out and when the user clicks the emailed verfication link I need to update a "status property".
#28345
Mar 04, 2009 9:50
* 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.