Type of save to perform on the page data object
Namespace:
EPiServer.DataAccessAssembly: EPiServer (in EPiServer.dll) Version: 5.2.375.236
Syntax
| C# |
|---|
public enum SaveAction |
Members
| Member name | Description | |
|---|---|---|
| None |
Do not save data.
| |
| Save |
Save a page, leaving it in a checked out state.
| |
| CheckIn |
Save and check in page, creating a new version only if necessary.
| |
| Publish |
Publish page, creating a new version only if necessary.
| |
| Reject |
Reject a checked-in page.
| |
| ForceNewVersion |
Flag that is used to force the creation of a new version.
| |
| ForceCurrentVersion |
Save and check in page, always updating the current version
| |
| ActionMask |
Mask to clear Force... settings from SaveAction
|
Remarks
This enumeration contains flag values (ForceNewVersion, ForceCurrentVersion) that provide additional information about the save operation. This means that if you need to check if a SaveAction value means Save, Checkin, Publish or Reject you need to clear the flag values first to do the comparison. This can be done using the ActionMask value which is shown in the second example below.
Examples
The following code example demonstrates the usage of SaveAction.
CopyC#
PageData pd = GetPage(CurrentPage.PageLink).CreateWritableClone(); pd["PageName"] = "New Page Name"; SaveAction action = SaveAction.None; if (pd.CheckPublishedStatus(PagePublishedStatus.PublishedIgnoreDates)) { action = SaveAction.Publish; } else { action = SaveAction.Save; } action = action | SaveAction.ForceCurrentVersion; DataFactory.Instance.Save(pd, action, AccessLevel.NoAccess);
Examples
This example shows how you can clear flag values from a SaveAction value to check if it represents a Save, CheckIn, Publish or Reject value. In this case we check if it is Save.
CopyC#
bool isSave = (value & SaveAction.ActionMask) == SaveAction.Save;