Rules Functions — This section describes functions which are performed on the rules table.
array mapi_rules_gettable(resource $emt);
boolean mapi_rules_modifytable(resource $emt,
array $rows,
long $flags);
array mapi_rules_gettable(resource $emt)
Returns the rules table from an IExchangeModifyTable interface.
This function opens a table view on the rules table from the IExchangeModifyTable interface. Returns an mapi table object on success, or FALSE on failure.
boolean mapi_rules_modifytable(resource $emt, array $rows, long $flags)
Modifies the rules table using the IExchangeModifyTable interface.
This function alters the rules table with the current row set. The previous table can be cleared when the ROWLIST_REPLACE is passed in the flags parameter. Returns an TRUE on success, or FALSE on failure.
Example 3.45. Modifying the rules table
// Get the interface $emt = mapi_folder_openmodifytable($inbox); $restriction = array(RES_CONTENT, array( FUZZYLEVEL => FL_SUBSTRING | FL_IGNORECASE, ULPROPTAG => PR_SUBJECT, VALUE => array(PR_SUBJECT=>'spam')) ); $action = array( array ( 'action' => OP_MOVE, 'storeentryid' => $publicstore_entryid, 'folderentryid' => $public_folder_entryid ), ); $rule = array( PR_RULE_ACTIONS => $action, PR_RULE_CONDITION => $restriction, PR_RULE_PROVIDER => 'RuleOrganizer', PR_RULE_STATE => ST_ENABLED, PR_RULE_NAME => 'move "spam" mails to "important" folder in the public store', ); $rows = array( 0 => array( 'rowflags' => ROW_ADD, 'properties' => $rule ) ); $result = mapi_rules_modifytable($emt, $rows); $rtable = mapi_rules_gettable($emt); $rules = mapi_table_queryallrows($rtable); print_r($rules);