Skip to content

Commit fe3383b

Browse files
committed
Add new Interest Groups rule
1 parent ab83420 commit fe3383b

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Alternatively, you can clone this repository, build the executable yourself and
3737

3838
- Others
3939
- Student Clubs
40+
- Interest Groups
4041
- Office of Marketing
4142
- Career Development Centre
4243
- Whatz Newz
@@ -64,6 +65,7 @@ Alternatively, you can clone this repository, build the executable yourself and
6465
6566
- Server-Side:
6667
- Filter and move all emails with sender addresses that contain `club.sutd.edu.sg` to the Student Clubs folder.
68+
- Filter and move all emails with sender addresses that contain `ig.sutd.edu.sg` to the Interest Groups folder.
6769
- Filter and move all emails with sender addresses that contain `marcom.sutd.edu.sg` to the Office of Marketing folder.
6870
- Filter and move all emails from [`careers@sutd.edu.sg`](mailto:careers@sutd.edu.sg) to the Career Development Centre folder.
6971
- Filter and move all emails with subjects that contain `Whatz Newz by Office of Student Life` to the Whatz Newz folder.

SUTDigest/OutlookWrapper.cs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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))

SUTDigest/SUTDigest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Description>SUTD Outlook Mail Classifier/Organizer.</Description>
1212
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
1313
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
14-
<Version>1.0.11</Version>
14+
<Version>1.0.12</Version>
1515
<PackageTags></PackageTags>
1616
<RepositoryUrl>https://github.com/jamestiotio/SUTDigest</RepositoryUrl>
1717
<PackageProjectUrl>https://github.com/jamestiotio/SUTDigest</PackageProjectUrl>

0 commit comments

Comments
 (0)