@@ -216,7 +216,8 @@ public void CreateFolders()
216216 researchFolder = null ,
217217 intlRelationsFolder = null ,
218218 hassEventsFolder = null ,
219- lkycicFolder = null ;
219+ lkycicFolder = null ,
220+ aiResearchFolder = null ;
220221 Outlook . Folders rootFolderFolders = null ,
221222 othersSubfolders = null ;
222223
@@ -250,6 +251,7 @@ public void CreateFolders()
250251 intlRelationsFolder = GetSubFolder ( @"Office of International Relations" , othersFolder , application ) ;
251252 hassEventsFolder = GetSubFolder ( @"HASS Events" , othersFolder , application ) ;
252253 lkycicFolder = GetSubFolder ( @"LKYCIC" , othersFolder , application ) ;
254+ aiResearchFolder = GetSubFolder ( @"AI Research" , othersFolder , application ) ;
253255 }
254256 catch ( Exception ex )
255257 {
@@ -275,6 +277,7 @@ public void CreateFolders()
275277 ReleaseComObject ( intlRelationsFolder ) ;
276278 ReleaseComObject ( hassEventsFolder ) ;
277279 ReleaseComObject ( lkycicFolder ) ;
280+ ReleaseComObject ( aiResearchFolder ) ;
278281 ReleaseComObject ( store ) ;
279282 ReleaseComObject ( session ) ;
280283 }
@@ -603,6 +606,30 @@ public void CreateRules()
603606
604607 rules . Save ( true ) ;
605608 }
609+
610+ string aiResearchRuleName = "AI Research Emails" ;
611+
612+ if ( ! RuleExist ( aiResearchRuleName , rules ) )
613+ {
614+ Outlook . MAPIFolder destinationFolder = GetFolder ( rootFolder . FolderPath + @"\Others\AI Research" , application ) ;
615+
616+ Outlook . Rule rule = rules . Create ( aiResearchRuleName , Outlook . OlRuleType . olRuleReceive ) ;
617+ Outlook . RuleConditions ruleConditions = rule . Conditions ;
618+
619+ Outlook . ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions . From ;
620+ senderAddressRuleCondition . Recipients . Add ( "AI_RESEARCH@sutd.edu.sg" ) ;
621+ senderAddressRuleCondition . Recipients . ResolveAll ( ) ;
622+ senderAddressRuleCondition . Enabled = true ;
623+
624+ Outlook . RuleActions ruleActions = rule . Actions ;
625+ Outlook . MoveOrCopyRuleAction moveRuleAction = ruleActions . MoveToFolder ;
626+ moveRuleAction . Folder = destinationFolder ;
627+ moveRuleAction . Enabled = true ;
628+
629+ ruleActions . Stop . Enabled = true ;
630+
631+ rules . Save ( true ) ;
632+ }
606633 }
607634 catch ( Exception ex )
608635 {
0 commit comments