Filing Rule Types
MacroView Corporate Email Filing (CEF) supports all the types of email filing rule that are currently available for personal filing rules in MacroView DMF and Message. For example:
- To contains fredd.nurk@acme.com
- Subject contains 'macroview' AND From contains 'dennis'
- Body contains 'macroview dmf'
- CC contains any of these words 'bob', 'carol', 'ted', 'alice'
In addition, MacroView CEF support filing rules that use filing tags (aka luggage tags) in the subject of an email to automatically file the email.
Corporate Filing Rules are defined in an configuration file that is stored in a central location in SharePoint which is retrieved by MacroView DMF or Message when Outlook is started, or when MacroView Mail is initiated.
The easiest way to create a rules configuration file is using the MacroView CEF Rule Builder.
This rest of this article explains in detail the structure of the rules rule and how to create and test your own corporate filing rules without using the MacroView CEF Rules Builder.
Rules structure and configuration
The rules XML file format is as follows:
<CorporateWorkflowRules>
<Rules>
Rule 1...
Rule 2...
Rule 3...
<\Rules>
<CorporateWorkflowRules>
Each rule has a number of components:
<Section> | Values | Purpose |
CorporateWorkFlowRule | Start and End marker for each rule | |
Expressions | Defines all of the property and match conditions for the rule. | |
WorkflowExpression | Defines a single rule condition. This section can be repeated if there are multiple conditions for the rule. | |
KeywordMatchType | All, Any, None or Regex | What type match of condition to apply. |
Keywords | Text | The text to match in the specified MailProperty |
CaseSensitive | true or false | Is the keywords match case sensitive |
MatchEntireWord | true or false |
Match only entire words specified in the keywords property |
MailProperty | ||
DisplayName | Text | Display name of the property |
PropertyName | ToSMTPAddresses, FromSMTPAddresses, CCSMTPAddresses, BCCSMTPAddresses, Subject, Body. TransfortMessageHeaders | Which email property does this expression use |
RuleEnabled | true or false | true or false |
SavePath | URL | URL to save location in SharePoint |
Name | Text | Display name for the rule |
SaveWebAppPath | URL | URL to the save paths web app |
Scope | Incoming, Outgoing or Both | Whether the rule applies to incoming, outgoing or both incoming and outgoing emails |
AllowInsertingTag | true or false | Can this rule use used to insert a filing tag in the email subject. Only applicable to Tag based rules. |
So a complete rule named Sample Filing Rule which saves any incoming email with a subject containing the string ACME to the https://tenant.sharepoint.com/sites/library/Emails folder might look like the following:
<CorporateWorkflowRules>
<Rules>
<CorporateWorkflowRule>
<Expressions>
<WorkflowExpression>
<KeywordMatchType>All</KeywordMatchType>
<Keywords>ACME</Keywords>
<CaseSensitive>false</CaseSensitive>
<MatchEntireWord>false</MatchEntireWord>
<MailProperty>
<DisplayName>Subject</DisplayName>
<PropertyName>Subject</PropertyName>
</MailProperty>
</WorkflowExpression>
</Expressions>
<RuleEnabled>true</RuleEnabled
<SavePath>https://tenant.sharepoint.com/sites/library/Emails</SavePath>
<Name>Sample Filing Rule</Name>
<SaveWebAppPath>https://tenant.sharepoint.com/</SaveWebAppPath>
<Scope>Incoming</Scope>
<AllowInsertingTag>false</AllowInsertingTag>
</CorporateWorkflowRule>
</Rules>
</CorporateWorkflowRules>
Advanced Filing Tag based rules
MacroView CEF support filing rules that use filing tags (aka luggage tags) in the subject of an email to automatically file that email.
To create this type of this type the <KeywordMatchType> for the rule should be set to RegEx and the <Keywords> can then contain a Regular Expression to identify a string in the email subject.
For example:
<Keywords>\[MG-([a-zA-Z]{5})\]</Keywords> would match [MG-ABCDE] or [MG-ZyXwV] but not [MG-XYX]
<Keywords>\[MV-([0-9]\]</Keywords> would match [MV-123] or [MV-987654] but not [MV-ABC123]
Refer to this online tool for a more information on defining and testing Regular Expressions
Using parts of the filing tag to define the save location
By adding named groups to the Regular Expression used to define the rules <Keywords> you can use these same named groups to substitute parts of the <SavePath> URL. This allows a single filing rule to cover any number of save locations, provided that the URL for each location has a consistent URL structure. The advantage is that a new rule is not required when new areas are created.
For example, the below rule will automatically save any incoming or outgoing email with a subject containing a tag in the format [MV-C0000-M1111] to the Emails folder in matter number 1111 of the client number 0000
i.e. https://tenant.sharepoint.com/sites/clients/C0000/matters/1111/Email folder
<CorporateWorkflowRules>
<Rules>
<CorporateWorkflowRule>
<Expressions>
<WorkflowExpression>
<KeywordMatchType>Regex</KeywordMatchType>
<Keywords>\[MV-(?<ClientNo>C[\d]{4})-M(?<MatterNo>[\d]{4})\]</Keywords>
<CaseSensitive>false</CaseSensitive>
<MatchEntireWord>false</MatchEntireWord>
<MailProperty>
<DisplayName>Subject</DisplayName>
<PropertyName>Subject</PropertyName>
</MailProperty>
</WorkflowExpression>
</Expressions>
<RuleEnabled>true</RuleEnabled>
<SavePath>https://tenant.sharepoint.com/sites/clients/<ClientNo>/matters/<MatterNo>/Email</SavePath>
<Name>[MV-C1234-M5678] Save to Client > Matter > Email folder</Name>
<SaveWebAppPath>https://tenant.sharepoint.com/</SaveWebAppPath>
<Scope>Both</Scope>
<AllowInsertingTag>true</AllowInsertingTag>
</CorporateWorkflowRule>
</Rules>
</CorporateWorkflowRules>
When using filing tag based rules (i.e. <KeywordMatchType> = RegEx) you can set <AllowInsertingTag> to true if you want users to be able to insert the tag corresponding with a selected location into the subject of emails using the Insert Tag or Tag and Save options on the MacroView ribbon in Outlook. See Inserting CEF filing tags to emails for more information.
Sample rules
Below are a number of sample filing rules to get you started. To add any of these rules to your corporate rules configuration file simply copy them into your corporate rules file file between the <Rules> and </Rules>
If you do not already have a corporate rules file you can download the Corporate Filing Rules Template
Incoming emails from a particular email address
The following rule would identify incoming emails from john.smith@gmail.com and save the email to: https://tenant.sharepoint.com/sites/hr/emp765/received emails
<CorporateWorkflowRule>
<Expressions>
<WorkflowExpression>
<KeywordMatchType>All</KeywordMatchType>
<Keywords>john.smith@gmail.com</Keywords>
<CaseSensitive>false</CaseSensitive>
<MatchEntireWord>false</MatchEntireWord>
<MailProperty>
<DisplayName>From</DisplayName>
<PropertyName>FromSMTPAddresses</PropertyName>
</MailProperty>
</WorkflowExpression>
</Expressions>
<RuleEnabled>true</RuleEnabled>
<SavePath>https://tenant.sharepoint.com/sites/hr/emp765/received emails</SavePath>
<Name>Email from john.smith@gmail.com to HR folder</Name>
<SaveWebAppPath>https://tenant.sharepoint.com/</SaveWebAppPath>
<Scope>Incoming</Scope>
<AllowInsertingTag>false</AllowInsertingTag>
</CorporateWorkflowRule>
Subject containing a 2 part code for client and project
The following rule would identify [MV-C001-M02] in the subject of an incoming where C001 is the client code and P02 is the project number for that client, and save the email to:
https://tenant.sharepoint.com/sites/C001/projects/02-Sample Project/Emails
<CorporateWorkflowRule>
<Expressions>
<WorkflowExpression>
<KeywordMatchType>Regex</KeywordMatchType>
<Keywords>\[MV-(?<ClientNumber>C[\d]{3})-P(?<ProjectNumber>[\d]{2})\]</Keywords>
<CaseSensitive>false</CaseSensitive>
<MatchEntireWord>false</MatchEntireWord>
<MailProperty>
<DisplayName>Subject</DisplayName>
<PropertyName>Subject</PropertyName>
</MailProperty>
</WorkflowExpression>
</Expressions>
<RuleEnabled>true</RuleEnabled>
<SavePath>https://tenant.sharepoint.com/sites/<ClientNumber>/projects/<ProjectNumber>([0-9A-Za-z- ]+)/Email</SavePath>
<Name>[MV-C123-P78] Save to Client > Project > Email folder</Name>
<SaveWebAppPath>https://tenanat.sharepoint.com/</SaveWebAppPath>
<Scope>Incoming</Scope>
<AllowInsertingTag>true</AllowInsertingTag>
</CorporateWorkflowRule>
Subject containing a single code for both client and matter
The following rule would identify [ABC0143] in the subject of an incoming or outgoing where ABC01 is the client code and ABC0143 is the matter number, and save the email to:
https://tenant.sharepoint.com/sites/ABC01/Matters/ABC0143-Sample Matter
<CorporateWorkflowRule>
<Expressions>
<WorkflowExpression>
<KeywordMatchType>Regex</KeywordMatchType>
<Keywords>\[(?<MatterNumber>(?<ClientNumber>[a-zA-Z0-9]{5})[\d]{1,3})\]</Keywords>
<CaseSensitive>false</CaseSensitive>
<MatchEntireWord>false</MatchEntireWord>
<MailProperty>
<DisplayName>Subject</DisplayName>
<PropertyName>Subject</PropertyName>
</MailProperty>
</WorkflowExpression>
</Expressions>
<RuleEnabled>true</RuleEnabled>
<SavePath>https://tenant.sharepoint.com/sites/<ClientNumber>/Matters/<MatterNumber>([0-9A-Za-z ]+)</SavePath>
<Name>[MatterNo] Save to Client > Matter folder</Name>
<SaveWebAppPath>https://tenant.sharepoint.com/</SaveWebAppPath>
<Scope>Both</Scope>
<AllowInsertingTag>true</AllowInsertingTag>
</CorporateWorkflowRule>
Prevent specific emails from matching other rules
See Creating a Corporate Email filing blacklist rule for information on how to exclude specific emails form saving when they match one of your existing filing rules.
Testing your rules
Save your rules XML file to a test library or folder in SharePoint then close down Outlook and exit the DMF local Service.
Next set the CorporateRulesFilePath setting in the registry to point to the test rules XML file and restart Outlook.
Open the Email Filing Rules dialog from the MacroView ribbon in Outlook and check that your new rules are listed on the Corporate Rules tab.
Make sure Enable Corporate Filing Rules is checked and then try out the new rules by either sending or receiving emails that match the rules. Alternatively, if there are already emails matching the rules exist in your Inbox or Sent Items folders, simply select them and click Run Filing Rules button on the MacroView tab in Outlook.
If your emails match a rule they with be marked in Outlook as either Saved to SharePoint by CEF or Not AutoFiled by CEF.
For more information on when these categories are applied refer to How to tell which emails have been saved
Comments
0 comments
Article is closed for comments.