I am trying to write some c# code to interact with Outlook 2010. I am currently using [this example from Microsoft](https://msdn.microsoft.com/en-us/library/office/ff184617.aspx).

My code follows:

```
using System;
using System.Text;          // StringBuilder
using System.Diagnostics;   // Debug

using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;

using Outlook = Microsoft.Office.Interop.Outlook;

namespace DirectReports
{
    public class Program
    {
        private void GetManagerDirectReports()
        {
            Outlook.AddressEntry currentUser = Application.Session.CurrentUser.AddressEntry;
            //Outlook.AddressEntry currentUser = Outlook.Application.Session.CurrentUser.AddressEntry;
            if (currentUser.Type == "EX")
            {
                Outlook.ExchangeUser manager = currentUser.GetExchangeUser().GetExchangeUserManager();
                if (manager != null)
                {
                    Outlook.AddressEntries addrEntries =
                        manager.GetDirectReports();
                    if (addrEntries != null)
                    {
                        foreach (Outlook.AddressEntry addrEntry
                            in addrEntries)
                        {
                            Outlook.ExchangeUser exchUser = addrEntry.GetExchangeUser();
                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine("Name: " + exchUser.Name);
                            sb.AppendLine("Title: " + exchUser.JobTitle);
                            sb.AppendLine("Department: " + exchUser.Department);
                            sb.AppendLine("Location: " + exchUser.OfficeLocation);
                            Debug.WriteLine(sb.ToString());
                        }
                    }
                }
            }
        }
    }
}

```

The Microsoft example mentions "If you use Visual Studio to test this code example, you must first add a reference to the Microsoft Outlook 15.0 Object Library component". I am working in Visual Studio Express 2013 for Windows Desktop. I did not see a version 15.0 object library, but added the version 14.0 one instead (which I think it the right one for Outlook 2010 anyways):

![references included](https://i.stack.imgur.com/zqMbg.png)

When I attempt a build, I get the following error:

```
The name 'Application' does not exist in the current context

```

I read a couple of references that indicate `Application` should be part of the above object libraries, but obviously it is not working here. Can someone please suggest what I am doing wrong?
['https://Stackoverflow.com/questions/31409868', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2683104/']
You can create a new `Application` object:

```
var appOutlook = new Microsoft.Office.Interop.Outlook.Application();

```

And then use it as:

```
Outlook.AddressEntry currentUser = appOutlook.Session.CurrentUser.AddressEntry;

```
Add the following line at the beginning of the file:

```
 using Microsoft.Office.Interop.Outlook;

```

Or just prepend any Outlook object declaration with the Outlook alias.

You may find the [C# app automates Outlook (CSAutomateOutlook)](https://code.msdn.microsoft.com/office/CSAutomateOutlook-a3b7bdc9) sample project helpful.