forked from TonyValenti/OutlookCom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
34 lines (27 loc) · 1.11 KB
/
Program.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace OutlookCom
{
class Program
{
static void Main(string[] args)
{
//This call always seems to return a type in a GAC assembly. How do I make it return a type in the Micrsofot.Office.Interop.Outlook DLL that I have referenced?
var Instance = Marshal.GetActiveObject("Outlook.Application");
if (Instance == null)
{
Console.WriteLine("NOT GOOD: Null Instance. Make sure you're running Outlook");
} else if (System.IO.Path.GetDirectoryName(Instance.GetType().Assembly.Location.ToLower()) == System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location.ToLower()))
{
Console.WriteLine("GOOD!!!: Using our version of the DLL");
} else
{
Console.WriteLine("NOT GOOD: Unexpected Path - Most likely GAC.");
}
}
}
}