Skip to content

Commit 2419373

Browse files
committed
Add new LKYCIC rule
1 parent a22239b commit 2419373

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
@@ -48,6 +48,7 @@ Alternatively, you can clone this repository, build the executable yourself and
4848
- Office of Research
4949
- Office of International Relations
5050
- HASS Events
51+
- LKYCIC
5152

5253
### Rules
5354

@@ -66,6 +67,7 @@ Alternatively, you can clone this repository, build the executable yourself and
6667
- Filter and move all emails from [`research@sutd.edu.sg`](mailto:research@sutd.edu.sg) to the Office of Research folder.
6768
- Filter and move all emails from [`global@sutd.edu.sg`](mailto:global@sutd.edu.sg) to the Office of International Relations folder.
6869
- Filter and move all emails from [`hassevents@sutd.edu.sg`](mailto:hassevents@sutd.edu.sg) to the HASS Events folder.
70+
- Filter and move all emails from [`lkycic@sutd.edu.sg`](mailto:lkycic@sutd.edu.sg) to the LKYCIC folder.
6971

7072
## Feedback
7173

SUTDigest/OutlookWrapper.cs

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

@@ -248,6 +249,7 @@ public void CreateFolders()
248249
researchFolder = GetSubFolder(@"Office of Research", othersFolder, application);
249250
intlRelationsFolder = GetSubFolder(@"Office of International Relations", othersFolder, application);
250251
hassEventsFolder = GetSubFolder(@"HASS Events", othersFolder, application);
252+
lkycicFolder = GetSubFolder(@"LKYCIC", othersFolder, application);
251253
}
252254
catch (Exception ex)
253255
{
@@ -272,6 +274,7 @@ public void CreateFolders()
272274
ReleaseComObject(researchFolder);
273275
ReleaseComObject(intlRelationsFolder);
274276
ReleaseComObject(hassEventsFolder);
277+
ReleaseComObject(lkycicFolder);
275278
ReleaseComObject(store);
276279
ReleaseComObject(session);
277280
}
@@ -576,6 +579,30 @@ public void CreateRules()
576579

577580
rules.Save(true);
578581
}
582+
583+
string lkycicRuleName = "LKYCIC Emails";
584+
585+
if (!RuleExist(lkycicRuleName, rules))
586+
{
587+
Outlook.MAPIFolder destinationFolder = GetFolder(rootFolder.FolderPath + @"\Others\LKYCIC", application);
588+
589+
Outlook.Rule rule = rules.Create(lkycicRuleName, Outlook.OlRuleType.olRuleReceive);
590+
Outlook.RuleConditions ruleConditions = rule.Conditions;
591+
592+
Outlook.ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions.From;
593+
senderAddressRuleCondition.Recipients.Add("lkycic@sutd.edu.sg");
594+
senderAddressRuleCondition.Recipients.ResolveAll();
595+
senderAddressRuleCondition.Enabled = true;
596+
597+
Outlook.RuleActions ruleActions = rule.Actions;
598+
Outlook.MoveOrCopyRuleAction moveRuleAction = ruleActions.MoveToFolder;
599+
moveRuleAction.Folder = destinationFolder;
600+
moveRuleAction.Enabled = true;
601+
602+
ruleActions.Stop.Enabled = true;
603+
604+
rules.Save(true);
605+
}
579606
}
580607
catch (Exception ex)
581608
{

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