@@ -215,7 +215,8 @@ public void CreateFolders()
215215 socialMediaReportFolder = null ,
216216 researchFolder = null ,
217217 intlRelationsFolder = null ,
218- hassEventsFolder = null ;
218+ hassEventsFolder = null ,
219+ lkycicFolder = null ;
219220 Outlook . Folders rootFolderFolders = null ,
220221 othersSubfolders = null ;
221222
@@ -248,6 +249,7 @@ public void CreateFolders()
248249 researchFolder = GetSubFolder ( @"Office of Research" , othersFolder , application ) ;
249250 intlRelationsFolder = GetSubFolder ( @"Office of International Relations" , othersFolder , application ) ;
250251 hassEventsFolder = GetSubFolder ( @"HASS Events" , othersFolder , application ) ;
252+ lkycicFolder = GetSubFolder ( @"LKYCIC" , othersFolder , application ) ;
251253 }
252254 catch ( Exception ex )
253255 {
@@ -272,6 +274,7 @@ public void CreateFolders()
272274 ReleaseComObject ( researchFolder ) ;
273275 ReleaseComObject ( intlRelationsFolder ) ;
274276 ReleaseComObject ( hassEventsFolder ) ;
277+ ReleaseComObject ( lkycicFolder ) ;
275278 ReleaseComObject ( store ) ;
276279 ReleaseComObject ( session ) ;
277280 }
@@ -576,6 +579,30 @@ public void CreateRules()
576579
577580 rules . Save ( true ) ;
578581 }
582+
583+ string lkycicRuleName = "LKYCIC Emails" ;
584+
585+ if ( ! RuleExist ( lkycicRuleName , rules ) )
586+ {
587+ Outlook . MAPIFolder destinationFolder = GetFolder ( rootFolder . FolderPath + @"\Others\LKYCIC" , application ) ;
588+
589+ Outlook . Rule rule = rules . Create ( lkycicRuleName , Outlook . OlRuleType . olRuleReceive ) ;
590+ Outlook . RuleConditions ruleConditions = rule . Conditions ;
591+
592+ Outlook . ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions . From ;
593+ senderAddressRuleCondition . Recipients . Add ( "lkycic@sutd.edu.sg" ) ;
594+ senderAddressRuleCondition . Recipients . ResolveAll ( ) ;
595+ senderAddressRuleCondition . Enabled = true ;
596+
597+ Outlook . RuleActions ruleActions = rule . Actions ;
598+ Outlook . MoveOrCopyRuleAction moveRuleAction = ruleActions . MoveToFolder ;
599+ moveRuleAction . Folder = destinationFolder ;
600+ moveRuleAction . Enabled = true ;
601+
602+ ruleActions . Stop . Enabled = true ;
603+
604+ rules . Save ( true ) ;
605+ }
579606 }
580607 catch ( Exception ex )
581608 {
0 commit comments