@@ -222,7 +222,8 @@ public void CreateFolders()
222222 wellbeingFolder = null ,
223223 uropFolder = null ,
224224 utopFolder = null ,
225- iapAdminFolder = null ;
225+ iapAdminFolder = null ,
226+ fablabFolder = null ;
226227 Outlook . Folders rootFolderFolders = null ,
227228 othersSubfolders = null ;
228229
@@ -262,6 +263,7 @@ public void CreateFolders()
262263 uropFolder = GetSubFolder ( @"UROP" , othersFolder , application ) ;
263264 utopFolder = GetSubFolder ( @"UTOP" , othersFolder , application ) ;
264265 iapAdminFolder = GetSubFolder ( @"IAP Admin" , othersFolder , application ) ;
266+ fablabFolder = GetSubFolder ( @"Fabrication Lab" , othersFolder , application ) ;
265267 }
266268 catch ( Exception ex )
267269 {
@@ -293,6 +295,7 @@ public void CreateFolders()
293295 ReleaseComObject ( uropFolder ) ;
294296 ReleaseComObject ( utopFolder ) ;
295297 ReleaseComObject ( iapAdminFolder ) ;
298+ ReleaseComObject ( fablabFolder ) ;
296299 ReleaseComObject ( store ) ;
297300 ReleaseComObject ( session ) ;
298301 }
@@ -765,6 +768,30 @@ public void CreateRules()
765768
766769 rules . Save ( true ) ;
767770 }
771+
772+ string fablabRuleName = "Fabrication Lab Emails" ;
773+
774+ if ( ! RuleExist ( fablabRuleName , rules ) )
775+ {
776+ Outlook . MAPIFolder destinationFolder = GetFolder ( rootFolder . FolderPath + @"\Others\Fabrication Lab" , application ) ;
777+
778+ Outlook . Rule rule = rules . Create ( fablabRuleName , Outlook . OlRuleType . olRuleReceive ) ;
779+ Outlook . RuleConditions ruleConditions = rule . Conditions ;
780+
781+ Outlook . ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions . From ;
782+ senderAddressRuleCondition . Recipients . Add ( "fablab@sutd.edu.sg" ) ;
783+ senderAddressRuleCondition . Recipients . ResolveAll ( ) ;
784+ senderAddressRuleCondition . Enabled = true ;
785+
786+ Outlook . RuleActions ruleActions = rule . Actions ;
787+ Outlook . MoveOrCopyRuleAction moveRuleAction = ruleActions . MoveToFolder ;
788+ moveRuleAction . Folder = destinationFolder ;
789+ moveRuleAction . Enabled = true ;
790+
791+ ruleActions . Stop . Enabled = true ;
792+
793+ rules . Save ( true ) ;
794+ }
768795 }
769796 catch ( Exception ex )
770797 {
0 commit comments