@@ -223,7 +223,8 @@ public void CreateFolders()
223223 uropFolder = null ,
224224 utopFolder = null ,
225225 iapAdminFolder = null ,
226- fablabFolder = null ;
226+ fablabFolder = null ,
227+ entrepreneurshipFolder = null ;
227228 Outlook . Folders rootFolderFolders = null ,
228229 othersSubfolders = null ;
229230
@@ -264,6 +265,7 @@ public void CreateFolders()
264265 utopFolder = GetSubFolder ( @"UTOP" , othersFolder , application ) ;
265266 iapAdminFolder = GetSubFolder ( @"IAP Admin" , othersFolder , application ) ;
266267 fablabFolder = GetSubFolder ( @"Fabrication Lab" , othersFolder , application ) ;
268+ entrepreneurshipFolder = GetSubFolder ( @"Entrepreneurship" , othersFolder , application ) ;
267269 }
268270 catch ( Exception ex )
269271 {
@@ -296,6 +298,7 @@ public void CreateFolders()
296298 ReleaseComObject ( utopFolder ) ;
297299 ReleaseComObject ( iapAdminFolder ) ;
298300 ReleaseComObject ( fablabFolder ) ;
301+ ReleaseComObject ( entrepreneurshipFolder ) ;
299302 ReleaseComObject ( store ) ;
300303 ReleaseComObject ( session ) ;
301304 }
@@ -792,6 +795,30 @@ public void CreateRules()
792795
793796 rules . Save ( true ) ;
794797 }
798+
799+ string entrepreneurshipRuleName = "Entrepreneurship Emails" ;
800+
801+ if ( ! RuleExist ( entrepreneurshipRuleName , rules ) )
802+ {
803+ Outlook . MAPIFolder destinationFolder = GetFolder ( rootFolder . FolderPath + @"\Others\Entrepreneurship" , application ) ;
804+
805+ Outlook . Rule rule = rules . Create ( entrepreneurshipRuleName , Outlook . OlRuleType . olRuleReceive ) ;
806+ Outlook . RuleConditions ruleConditions = rule . Conditions ;
807+
808+ Outlook . ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions . From ;
809+ senderAddressRuleCondition . Recipients . Add ( "entrepreneurship@sutd.edu.sg" ) ;
810+ senderAddressRuleCondition . Recipients . ResolveAll ( ) ;
811+ senderAddressRuleCondition . Enabled = true ;
812+
813+ Outlook . RuleActions ruleActions = rule . Actions ;
814+ Outlook . MoveOrCopyRuleAction moveRuleAction = ruleActions . MoveToFolder ;
815+ moveRuleAction . Folder = destinationFolder ;
816+ moveRuleAction . Enabled = true ;
817+
818+ ruleActions . Stop . Enabled = true ;
819+
820+ rules . Save ( true ) ;
821+ }
795822 }
796823 catch ( Exception ex )
797824 {
0 commit comments