@@ -205,6 +205,7 @@ public void CreateFolders()
205205 Outlook . Folder rootFolder = null ,
206206 othersFolder = null ,
207207 studentClubsFolder = null ,
208+ interestGroupsFolder = null ,
208209 marketingFolder = null ,
209210 cdcFolder = null ,
210211 whatzNewzFolder = null ,
@@ -246,6 +247,7 @@ public void CreateFolders()
246247 othersSubfolders = othersFolder . Folders ;
247248
248249 studentClubsFolder = GetSubFolder ( @"Student Clubs" , othersFolder , application ) ;
250+ interestGroupsFolder = GetSubFolder ( @"Interest Groups" , othersFolder , application ) ;
249251 marketingFolder = GetSubFolder ( @"Office of Marketing" , othersFolder , application ) ;
250252 cdcFolder = GetSubFolder ( @"Career Development Centre" , othersFolder , application ) ;
251253 whatzNewzFolder = GetSubFolder ( @"Whatz Newz" , othersFolder , application ) ;
@@ -279,6 +281,7 @@ public void CreateFolders()
279281 ReleaseComObject ( othersFolder ) ;
280282 ReleaseComObject ( othersSubfolders ) ;
281283 ReleaseComObject ( studentClubsFolder ) ;
284+ ReleaseComObject ( interestGroupsFolder ) ;
282285 ReleaseComObject ( marketingFolder ) ;
283286 ReleaseComObject ( cdcFolder ) ;
284287 ReleaseComObject ( whatzNewzFolder ) ;
@@ -320,13 +323,13 @@ public void CreateRules()
320323 rootFolder = store . GetRootFolder ( ) ;
321324
322325 // Rules are identified by name
323- string studentClubRuleName = "Emails from Student Clubs" ;
326+ string studentClubsRuleName = "Emails from Student Clubs" ;
324327
325- if ( ! RuleExist ( studentClubRuleName , rules ) )
328+ if ( ! RuleExist ( studentClubsRuleName , rules ) )
326329 {
327330 Outlook . MAPIFolder destinationFolder = GetFolder ( rootFolder . FolderPath + @"\Others\Student Clubs" , application ) ;
328331
329- Outlook . Rule rule = rules . Create ( studentClubRuleName , Outlook . OlRuleType . olRuleReceive ) ;
332+ Outlook . Rule rule = rules . Create ( studentClubsRuleName , Outlook . OlRuleType . olRuleReceive ) ;
330333 Outlook . RuleConditions ruleConditions = rule . Conditions ;
331334
332335 Outlook . AddressRuleCondition senderAddressRuleCondition = ruleConditions . SenderAddress ;
@@ -345,6 +348,29 @@ public void CreateRules()
345348 rules . Save ( true ) ;
346349 }
347350
351+ string interestGroupsRuleName = "Emails from Interest Groups" ;
352+
353+ if ( ! RuleExist ( interestGroupsRuleName , rules ) )
354+ {
355+ Outlook . MAPIFolder destinationFolder = GetFolder ( rootFolder . FolderPath + @"\Others\Interest Groups" , application ) ;
356+
357+ Outlook . Rule rule = rules . Create ( interestGroupsRuleName , Outlook . OlRuleType . olRuleReceive ) ;
358+ Outlook . RuleConditions ruleConditions = rule . Conditions ;
359+
360+ Outlook . AddressRuleCondition senderAddressRuleCondition = ruleConditions . SenderAddress ;
361+ senderAddressRuleCondition . Address = new string [ ] { "ig.sutd.edu.sg" } ;
362+ senderAddressRuleCondition . Enabled = true ;
363+
364+ Outlook . RuleActions ruleActions = rule . Actions ;
365+ Outlook . MoveOrCopyRuleAction moveRuleAction = ruleActions . MoveToFolder ;
366+ moveRuleAction . Folder = destinationFolder ;
367+ moveRuleAction . Enabled = true ;
368+
369+ ruleActions . Stop . Enabled = true ;
370+
371+ rules . Save ( true ) ;
372+ }
373+
348374 string marketingRuleName = "Emails from Office of Marketing" ;
349375
350376 if ( ! RuleExist ( marketingRuleName , rules ) )
0 commit comments