Skip to content

Commit d4e2b0c

Browse files
committed
Add new UROP and UTOP rules
1 parent f3fa5ce commit d4e2b0c

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Simply put, we just want a double-clickable binary file that can setup, settle a
2323
2424
Before everything else, please ensure that you have logged in into your Microsoft Outlook account on your computer's Outlook desktop application (not the web client nor the Mail desktop program) and that you currently have and are connected to a working Internet connection.
2525

26-
Also ensure that you currently do not have any "conflicting" rules in your Microsoft Outlook profile. A clean slate would be the best recommended state, but if that is not possible/desirable, then you can check against the [catalogue section](#catalogue) below to ensure that there are no conflicting rules.
26+
Folders and rules are identified by name. As such, later "addition" updates of this software are automatically compatible to previous versions (except if there are name-related changes). However, it might not necessarily be compatible with other user-defined custom rules. As such, please also ensure that you currently do not have any "conflicting" rules in your Microsoft Outlook profile. A clean slate would be the best recommended state, but if that is not possible/desirable, then you can check against the [catalogue section](#catalogue) below to ensure that there are no conflicting rules.
2727

2828
You can download the ZIP file (latest version) from the [Releases](https://github.com/jamestiotio/SUTDigest/releases/latest) page and then run (double-click) the binary executable file (`SUTDigest.exe`). Wait for a while as the program executes the corresponding instructions. You can know that the program is done once the folders and the rules are present in your Outlook and a system indicator 'beep' sound on Windows can be heard.
2929

@@ -52,6 +52,8 @@ Alternatively, you can clone this repository, build the executable yourself and
5252
- AI Research
5353
- SMT
5454
- Wellbeing Services
55+
- UROP
56+
- UTOP
5557

5658
### Rules
5759

@@ -74,6 +76,8 @@ Alternatively, you can clone this repository, build the executable yourself and
7476
- Filter and move all emails from [`AI_RESEARCH@sutd.edu.sg`](mailto:AI_RESEARCH@sutd.edu.sg) to the AI Research folder.
7577
- Filter and move all emails from [`sci-math@sutd.edu.sg`](mailto:sci-math@sutd.edu.sg) to the SMT folder.
7678
- Filter and move all emails from [`wellbeing@sutd.edu.sg`](mailto:wellbeing@sutd.edu.sg) to the Wellbeing Services folder.
79+
- Filter and move all emails from [`urop@sutd.edu.sg`](mailto:urop@sutd.edu.sg) to the UROP folder.
80+
- Filter and move all emails from [`utop@sutd.edu.sg`](mailto:utop@sutd.edu.sg) to the UTOP folder.
7781

7882
## Feedback
7983

SUTDigest/OutlookWrapper.cs

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ public void CreateFolders()
219219
lkycicFolder = null,
220220
aiResearchFolder = null,
221221
smtFolder = null,
222-
wellbeingFolder = null;
222+
wellbeingFolder = null,
223+
uropFolder = null,
224+
utopFolder = null;
223225
Outlook.Folders rootFolderFolders = null,
224226
othersSubfolders = null;
225227

@@ -256,6 +258,8 @@ public void CreateFolders()
256258
aiResearchFolder = GetSubFolder(@"AI Research", othersFolder, application);
257259
smtFolder = GetSubFolder(@"SMT", othersFolder, application);
258260
wellbeingFolder = GetSubFolder(@"Wellbeing Services", othersFolder, application);
261+
uropFolder = GetSubFolder(@"UROP", othersFolder, application);
262+
utopFolder = GetSubFolder(@"UTOP", othersFolder, application);
259263
}
260264
catch (Exception ex)
261265
{
@@ -284,6 +288,8 @@ public void CreateFolders()
284288
ReleaseComObject(aiResearchFolder);
285289
ReleaseComObject(smtFolder);
286290
ReleaseComObject(wellbeingFolder);
291+
ReleaseComObject(uropFolder);
292+
ReleaseComObject(utopFolder);
287293
ReleaseComObject(store);
288294
ReleaseComObject(session);
289295
}
@@ -684,6 +690,54 @@ public void CreateRules()
684690

685691
rules.Save(true);
686692
}
693+
694+
string uropRuleName = "UROP Emails";
695+
696+
if (!RuleExist(uropRuleName, rules))
697+
{
698+
Outlook.MAPIFolder destinationFolder = GetFolder(rootFolder.FolderPath + @"\Others\UROP", application);
699+
700+
Outlook.Rule rule = rules.Create(uropRuleName, Outlook.OlRuleType.olRuleReceive);
701+
Outlook.RuleConditions ruleConditions = rule.Conditions;
702+
703+
Outlook.ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions.From;
704+
senderAddressRuleCondition.Recipients.Add("urop@sutd.edu.sg");
705+
senderAddressRuleCondition.Recipients.ResolveAll();
706+
senderAddressRuleCondition.Enabled = true;
707+
708+
Outlook.RuleActions ruleActions = rule.Actions;
709+
Outlook.MoveOrCopyRuleAction moveRuleAction = ruleActions.MoveToFolder;
710+
moveRuleAction.Folder = destinationFolder;
711+
moveRuleAction.Enabled = true;
712+
713+
ruleActions.Stop.Enabled = true;
714+
715+
rules.Save(true);
716+
}
717+
718+
string utopRuleName = "UTOP Emails";
719+
720+
if (!RuleExist(utopRuleName, rules))
721+
{
722+
Outlook.MAPIFolder destinationFolder = GetFolder(rootFolder.FolderPath + @"\Others\UTOP", application);
723+
724+
Outlook.Rule rule = rules.Create(utopRuleName, Outlook.OlRuleType.olRuleReceive);
725+
Outlook.RuleConditions ruleConditions = rule.Conditions;
726+
727+
Outlook.ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions.From;
728+
senderAddressRuleCondition.Recipients.Add("utop@sutd.edu.sg");
729+
senderAddressRuleCondition.Recipients.ResolveAll();
730+
senderAddressRuleCondition.Enabled = true;
731+
732+
Outlook.RuleActions ruleActions = rule.Actions;
733+
Outlook.MoveOrCopyRuleAction moveRuleAction = ruleActions.MoveToFolder;
734+
moveRuleAction.Folder = destinationFolder;
735+
moveRuleAction.Enabled = true;
736+
737+
ruleActions.Stop.Enabled = true;
738+
739+
rules.Save(true);
740+
}
687741
}
688742
catch (Exception ex)
689743
{

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