Skip to content

Commit 985bbe3

Browse files
committed
Add new AI Research rule
1 parent 2419373 commit 985bbe3

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Alternatively, you can clone this repository, build the executable yourself and
4949
- Office of International Relations
5050
- HASS Events
5151
- LKYCIC
52+
- AI Research
5253

5354
### Rules
5455

@@ -68,6 +69,7 @@ Alternatively, you can clone this repository, build the executable yourself and
6869
- Filter and move all emails from [`global@sutd.edu.sg`](mailto:global@sutd.edu.sg) to the Office of International Relations folder.
6970
- Filter and move all emails from [`hassevents@sutd.edu.sg`](mailto:hassevents@sutd.edu.sg) to the HASS Events folder.
7071
- Filter and move all emails from [`lkycic@sutd.edu.sg`](mailto:lkycic@sutd.edu.sg) to the LKYCIC folder.
72+
- Filter and move all emails from [`AI_RESEARCH@sutd.edu.sg`](mailto:AI_RESEARCH@sutd.edu.sg) to the AI Research folder.
7173

7274
## Feedback
7375

SUTDigest/OutlookWrapper.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ public void CreateFolders()
216216
researchFolder = null,
217217
intlRelationsFolder = null,
218218
hassEventsFolder = null,
219-
lkycicFolder = null;
219+
lkycicFolder = null,
220+
aiResearchFolder = null;
220221
Outlook.Folders rootFolderFolders = null,
221222
othersSubfolders = null;
222223

@@ -250,6 +251,7 @@ public void CreateFolders()
250251
intlRelationsFolder = GetSubFolder(@"Office of International Relations", othersFolder, application);
251252
hassEventsFolder = GetSubFolder(@"HASS Events", othersFolder, application);
252253
lkycicFolder = GetSubFolder(@"LKYCIC", othersFolder, application);
254+
aiResearchFolder = GetSubFolder(@"AI Research", othersFolder, application);
253255
}
254256
catch (Exception ex)
255257
{
@@ -275,6 +277,7 @@ public void CreateFolders()
275277
ReleaseComObject(intlRelationsFolder);
276278
ReleaseComObject(hassEventsFolder);
277279
ReleaseComObject(lkycicFolder);
280+
ReleaseComObject(aiResearchFolder);
278281
ReleaseComObject(store);
279282
ReleaseComObject(session);
280283
}
@@ -603,6 +606,30 @@ public void CreateRules()
603606

604607
rules.Save(true);
605608
}
609+
610+
string aiResearchRuleName = "AI Research Emails";
611+
612+
if (!RuleExist(aiResearchRuleName, rules))
613+
{
614+
Outlook.MAPIFolder destinationFolder = GetFolder(rootFolder.FolderPath + @"\Others\AI Research", application);
615+
616+
Outlook.Rule rule = rules.Create(aiResearchRuleName, Outlook.OlRuleType.olRuleReceive);
617+
Outlook.RuleConditions ruleConditions = rule.Conditions;
618+
619+
Outlook.ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions.From;
620+
senderAddressRuleCondition.Recipients.Add("AI_RESEARCH@sutd.edu.sg");
621+
senderAddressRuleCondition.Recipients.ResolveAll();
622+
senderAddressRuleCondition.Enabled = true;
623+
624+
Outlook.RuleActions ruleActions = rule.Actions;
625+
Outlook.MoveOrCopyRuleAction moveRuleAction = ruleActions.MoveToFolder;
626+
moveRuleAction.Folder = destinationFolder;
627+
moveRuleAction.Enabled = true;
628+
629+
ruleActions.Stop.Enabled = true;
630+
631+
rules.Save(true);
632+
}
606633
}
607634
catch (Exception ex)
608635
{

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.4</Version>
14+
<Version>1.0.5</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)