-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhyMeRibbon.cs
More file actions
46 lines (41 loc) · 1.53 KB
/
WhyMeRibbon.cs
File metadata and controls
46 lines (41 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Diagnostics;
using System.Windows.Forms;
namespace WhyMe
{
public partial class WhyMeRibbon
{
private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
}
private void button1_Click(object sender, RibbonControlEventArgs e)
{
Outlook.Application application = Globals.ThisAddIn.Application;
Outlook.Inspector inspector = application.ActiveInspector();
Outlook.MailItem myMailItem = (Outlook.MailItem)inspector.CurrentItem;
ThisAddIn.Membership found = null;
foreach (Outlook.Recipient r in myMailItem.Recipients)
{
Debug.WriteLine("Searching for: " + r.AddressEntry.Name);
found = Globals.ThisAddIn.IsMemberOf(r.AddressEntry);
if (found != null)
break;
}
if (found != null)
{
Debug.WriteLine(found.ToString());
MessageBox.Show(found.ToString(), "Why Me?", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
Debug.WriteLine("NOT FOUND");
MessageBox.Show("Couldn't Find you. Perhaps you were BCC'd?", "Why Me?", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}