Skip to content

Commit

Permalink
Add new UROP and UTOP rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestiotio committed Nov 1, 2021
1 parent f3fa5ce commit d4e2b0c
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Simply put, we just want a double-clickable binary file that can setup, settle a
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.

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.
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.

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.

Expand Down Expand Up @@ -52,6 +52,8 @@ Alternatively, you can clone this repository, build the executable yourself and
- AI Research
- SMT
- Wellbeing Services
- UROP
- UTOP

### Rules

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

## Feedback

Expand Down
56 changes: 55 additions & 1 deletion SUTDigest/OutlookWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ public void CreateFolders()
lkycicFolder = null,
aiResearchFolder = null,
smtFolder = null,
wellbeingFolder = null;
wellbeingFolder = null,
uropFolder = null,
utopFolder = null;
Outlook.Folders rootFolderFolders = null,
othersSubfolders = null;

Expand Down Expand Up @@ -256,6 +258,8 @@ public void CreateFolders()
aiResearchFolder = GetSubFolder(@"AI Research", othersFolder, application);
smtFolder = GetSubFolder(@"SMT", othersFolder, application);
wellbeingFolder = GetSubFolder(@"Wellbeing Services", othersFolder, application);
uropFolder = GetSubFolder(@"UROP", othersFolder, application);
utopFolder = GetSubFolder(@"UTOP", othersFolder, application);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -284,6 +288,8 @@ public void CreateFolders()
ReleaseComObject(aiResearchFolder);
ReleaseComObject(smtFolder);
ReleaseComObject(wellbeingFolder);
ReleaseComObject(uropFolder);
ReleaseComObject(utopFolder);
ReleaseComObject(store);
ReleaseComObject(session);
}
Expand Down Expand Up @@ -684,6 +690,54 @@ public void CreateRules()

rules.Save(true);
}

string uropRuleName = "UROP Emails";

if (!RuleExist(uropRuleName, rules))
{
Outlook.MAPIFolder destinationFolder = GetFolder(rootFolder.FolderPath + @"\Others\UROP", application);

Outlook.Rule rule = rules.Create(uropRuleName, Outlook.OlRuleType.olRuleReceive);
Outlook.RuleConditions ruleConditions = rule.Conditions;

Outlook.ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions.From;
senderAddressRuleCondition.Recipients.Add("urop@sutd.edu.sg");
senderAddressRuleCondition.Recipients.ResolveAll();
senderAddressRuleCondition.Enabled = true;

Outlook.RuleActions ruleActions = rule.Actions;
Outlook.MoveOrCopyRuleAction moveRuleAction = ruleActions.MoveToFolder;
moveRuleAction.Folder = destinationFolder;
moveRuleAction.Enabled = true;

ruleActions.Stop.Enabled = true;

rules.Save(true);
}

string utopRuleName = "UTOP Emails";

if (!RuleExist(utopRuleName, rules))
{
Outlook.MAPIFolder destinationFolder = GetFolder(rootFolder.FolderPath + @"\Others\UTOP", application);

Outlook.Rule rule = rules.Create(utopRuleName, Outlook.OlRuleType.olRuleReceive);
Outlook.RuleConditions ruleConditions = rule.Conditions;

Outlook.ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions.From;
senderAddressRuleCondition.Recipients.Add("utop@sutd.edu.sg");
senderAddressRuleCondition.Recipients.ResolveAll();
senderAddressRuleCondition.Enabled = true;

Outlook.RuleActions ruleActions = rule.Actions;
Outlook.MoveOrCopyRuleAction moveRuleAction = ruleActions.MoveToFolder;
moveRuleAction.Folder = destinationFolder;
moveRuleAction.Enabled = true;

ruleActions.Stop.Enabled = true;

rules.Save(true);
}
}
catch (Exception ex)
{
Expand Down
2 changes: 1 addition & 1 deletion SUTDigest/SUTDigest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Description>SUTD Outlook Mail Classifier/Organizer.</Description>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<Version>1.0.7</Version>
<Version>1.0.8</Version>
<PackageTags></PackageTags>
<RepositoryUrl>https://github.com/jamestiotio/SUTDigest</RepositoryUrl>
<PackageProjectUrl>https://github.com/jamestiotio/SUTDigest</PackageProjectUrl>
Expand Down

0 comments on commit d4e2b0c

Please sign in to comment.