Creating a Rule
To create a rule, prepare its contents and insert the new rule in the rule table.
To create a rule
-
Retrieve an interface pointer to the rule object by calling HrFolderRulesOpen.
-
Find the position in the rule table where you want to insert the rule. Use the rule object’s IExchangeFolderRules::HrSeek method to seek to the correct position.
-
Call the HrStringToRestriction function to prepare the restriction (the conditions) for the new rule. This function returns a pointer to an SRestriction structure that contains the restriction.
-
Call the HrStringToAction function to prepare and obtain a pointer to the ACTION structure for the new rule.
-
Create the new rule by calling the IExchangeFolderRules::HrInsert method. This method inserts a new rule into the set of rules for the folder.
For an example of rule insertion, see the DoDelete function and the DoInsert function in the \BKOFFICE\SAMPLES\EXCHANGE\RULEEDIT\RULEEDIT.CPP file.