| Platform SDK: Exchange Server |
The Actions COM class is an ordered collection that defines an object with methods and properties that you can use to access, create, and delete actions that occur when rule conditions are satisfied.
The Actions COM class is a collection of Action objects, each of which represents an action that is taken when a rule condition is satisfied.
The following example enumerates the actions on the first rule in the Inbox folder of the TestUser account on Microsoft Exchange server SERVER.
const ACTION_MOVE = 1
const ACTION_COPY = 2
const ACTION_DELETE = 3
const ACTION_REPLY = 4
const ACTION_OOFREPLY = 5
const ACTION_FORWARD = 6
const ACTION_DELEGATE = 7
const ACTION_BOUNCE = 8
const ACTION_TAG = 9
const ACTION_MARKREAD = 10
const ACTION_DEFER = 11
Set mySession = CreateObject("MAPI.Session")
mySession.Logon "","",false,true,true,true,"SERVER" & vbLF & "TestUser"
Set myRules = CreateObject("MSExchange.Rules")
myRules.Folder = mySession.Inbox
Set myRule = myRules.Item(1)
Prompt = "Rule " & myRule.Name & " has the following actions"
Wscript.Echo Prompt
For Each myAction in myRule.Actions
Select Case myAction.ActionType
Case ACTION_MOVE
Wscript.Echo " Move"
Case ACTION_COPY
Wscript.Echo " Copy"
Case ACTION_DELETE
Wscript.Echo " Delete"
Case ACTION_REPLY
Wscript.Echo " Reply"
Case ACTION_OOFREPLY
Wscript.Echo " OOF reply"
Case ACTION_FORWARD
Wscript.Echo " Forward"
Case ACTION_DELEGATE
Wscript.Echo " Delegate"
Case ACTION_BOUNCE
Wscript.Echo " Bounce"
Case ACTION_TAG
Wscript.Echo " Tag"
Case ACTION_MARKREAD
Wscript.Echo " Mark read"
Case ACTION_DEFER
Wscript.Echo " Defer"
End Select
Next
mySession.Logoff
Set mySession = Nothing
Set myRules = Nothing
Set myRule = Nothing
Set myAction = Nothing