Skip to content

Commit ab83420

Browse files
committed
Add new Entrepreneurship rule
1 parent 16bd46d commit ab83420

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
@@ -56,6 +56,7 @@ Alternatively, you can clone this repository, build the executable yourself and
5656
- UTOP
5757
- IAP Admin
5858
- Fabrication Lab
59+
- Entrepreneurship
5960

6061
### Rules
6162

@@ -82,6 +83,7 @@ Alternatively, you can clone this repository, build the executable yourself and
8283
- Filter and move all emails from [`utop@sutd.edu.sg`](mailto:utop@sutd.edu.sg) to the UTOP folder.
8384
- Filter and move all emails from [`iapadmin@sutd.edu.sg`](mailto:iapadmin@sutd.edu.sg) to the IAP Admin folder.
8485
- Filter and move all emails from [`fablab@sutd.edu.sg`](mailto:fablab@sutd.edu.sg) to the Fabrication Lab folder.
86+
- Filter and move all emails from [`entrepreneurship@sutd.edu.sg`](mailto:entrepreneurship@sutd.edu.sg) to the Entrepreneurship folder.
8587

8688
## Feedback
8789

SUTDigest/OutlookWrapper.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ public void CreateFolders()
223223
uropFolder = null,
224224
utopFolder = null,
225225
iapAdminFolder = null,
226-
fablabFolder = null;
226+
fablabFolder = null,
227+
entrepreneurshipFolder = null;
227228
Outlook.Folders rootFolderFolders = null,
228229
othersSubfolders = null;
229230

@@ -264,6 +265,7 @@ public void CreateFolders()
264265
utopFolder = GetSubFolder(@"UTOP", othersFolder, application);
265266
iapAdminFolder = GetSubFolder(@"IAP Admin", othersFolder, application);
266267
fablabFolder = GetSubFolder(@"Fabrication Lab", othersFolder, application);
268+
entrepreneurshipFolder = GetSubFolder(@"Entrepreneurship", othersFolder, application);
267269
}
268270
catch (Exception ex)
269271
{
@@ -296,6 +298,7 @@ public void CreateFolders()
296298
ReleaseComObject(utopFolder);
297299
ReleaseComObject(iapAdminFolder);
298300
ReleaseComObject(fablabFolder);
301+
ReleaseComObject(entrepreneurshipFolder);
299302
ReleaseComObject(store);
300303
ReleaseComObject(session);
301304
}
@@ -792,6 +795,30 @@ public void CreateRules()
792795

793796
rules.Save(true);
794797
}
798+
799+
string entrepreneurshipRuleName = "Entrepreneurship Emails";
800+
801+
if (!RuleExist(entrepreneurshipRuleName, rules))
802+
{
803+
Outlook.MAPIFolder destinationFolder = GetFolder(rootFolder.FolderPath + @"\Others\Entrepreneurship", application);
804+
805+
Outlook.Rule rule = rules.Create(entrepreneurshipRuleName, Outlook.OlRuleType.olRuleReceive);
806+
Outlook.RuleConditions ruleConditions = rule.Conditions;
807+
808+
Outlook.ToOrFromRuleCondition senderAddressRuleCondition = ruleConditions.From;
809+
senderAddressRuleCondition.Recipients.Add("entrepreneurship@sutd.edu.sg");
810+
senderAddressRuleCondition.Recipients.ResolveAll();
811+
senderAddressRuleCondition.Enabled = true;
812+
813+
Outlook.RuleActions ruleActions = rule.Actions;
814+
Outlook.MoveOrCopyRuleAction moveRuleAction = ruleActions.MoveToFolder;
815+
moveRuleAction.Folder = destinationFolder;
816+
moveRuleAction.Enabled = true;
817+
818+
ruleActions.Stop.Enabled = true;
819+
820+
rules.Save(true);
821+
}
795822
}
796823
catch (Exception ex)
797824
{

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