Class MoveOrCopyRuleAction (Outlook VBA)
The class MoveOrCopyRuleAction represents an action that moves or copies a message. To use a MoveOrCopyRuleAction class variable it first needs to be instantiated, for example
Dim moc as MoveOrCopyRuleAction
Set moc = Session.DefaultStore.GetRules(1).Actions
ActionType
Returns a constant, olRuleActionMoveToFolder, from the OlRuleActionType enumeration that indicates the type of action that is taken by the rule. Here you can find possible values for
The moving or copying rule action is supported only by rules for receiving messages. For more information, see Specify Rule Actions.
Dim oraActionType As OlRuleActionType
oraActionType = Session.DefaultStore.GetRules(1).Actions.CopyToFolder.ActionType
Class
Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for
Dim oocsClass As OlObjectClass
oocsClass = Session.DefaultStore.GetRules(1).Actions.CopyToFolder.Class
Enabled
Returns or sets a Boolean that determines if the rule action is enabled.
After you enable a rule, you must also save the rule by using Rules.Save so that the rule and its enabled state will persist beyond the current session. A rule is only enabled after it has been saved successfully.
Session.DefaultStore.GetRules(1).Actions.CopyToFolder.Enabled = True
Folder
Returns or sets a Folder object that represents the folder to which the rule moves or copies the message.
If no folder has been assigned to the move or copy rule action, this property is Null (Nothing in Visual Basic). This property returns an error if the specified folder cannot serve as a target folder for the copy or move operation. For example, the folder is a search folder, is read-only, or the user does not have the required permissions to move or copy messages to it.
Session.DefaultStore.GetRules(1).Actions.CopyToFolder.Folder =
Session
Returns the NameSpace object for the current session.
The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements perform the same function: