SaveAction

Vote:
 
Hi. Anyone have any experience with the EPiServer.DataAccess.SaveAction enum? Would like to know the difference on each option. This is poorly described in the SDK. Frank :)
#12148
Oct 11, 2004 15:27
Vote:
 
Here is some brief info: The most common SaveAction flags: SaveAction.Save - Save the page, leaving it in a checked out state. SaveAction.CheckIn - Save and check in the page, creating a new version only if necessary. SaveAction.Reject - Reject a checked-in page. SaveAction.Publish - Publish the page, creating a new version only if necessary. And a couple of rare flags, mainly for internal use: SaveAction.None - Like it says, no action. Page is not saved. SaveAction.ForceNewVersion - Flag that is used to force the creation of a new version. SaveAction.ForceCurrentVersion - Save and check in the page, always updating the current version.
#13735
Oct 11, 2004 16:27
Vote:
 
Thanks for the feedback. I've got the following case: I have created a admin plugin for copying page content from one property to another within the same page type. This is mainly used for copying content from one language to another, i.e. EPi sites that are converted from standard to multi-language. Only one property is copied and saved at a time. I experimented some on the different SaveAction settings. If I used any of the settings beside "Publish", the page was always saved in a new version, with the latest version saved with only PageName, and the second latest version only with MainBody. Any comment on this? Something I do wrong? Which SaveAction am I supposed to use? Aside, it would be better to use, say, "CheckIn", so the editor can approve the page before it gets the status "Published". Frank :)
#13736
Oct 12, 2004 10:18
Vote:
 
A little note, the ForceCurrentVersion only works if you are working on a specific version of the page (it could still be the published one, but EPiServer needs the version number in order to keep the version.) This code shows how to get the published version of a specific page. // We want to replace the currently published version. To do // that, we need to make sure we load that specific version // (just the page ID will not be enough.) PageReference pageRef = new PageReference(id); PageVersion pubVer = PageVersion.LoadPublishedVersion(pageRef); // if no published version exists, we wont save. if (pubVer == null) break; PageReference pubRef = pubVer.ID; PageData page = Global.EPDataFactory.GetPage(pubRef); ... do things with the page here SaveAction action = SaveAction.None; if (page.CheckPublishedStatus(PagePublishedStatus.Ignore)) action = SaveAction.Publish; else action = SaveAction.Save; // Do not create a new version action = action | SaveAction.ForceCurrentVersion; // Save the page Global.EPDataFactory.Save(page, action);
#13737
Oct 12, 2004 10:31
* 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.