How to reference default folder in C#

D

Dave

The following C# code returns the error:

The name 'olFolderContacts' does not exist in the class or namespace
'OutlookSyncConsole.Class1'

I have a reference set to the Outlook 11 type library in my C# project.

Can anyone tell me how to reference the default folder in C#?

Thanks
Dave
-------------------------------------------

static void Main(string[] args)
{
Console.WriteLine("Outlook");

Outlook.Application ola = new Outlook.Application();
Outlook.NameSpace ns;
Outlook.MAPIFolder mf;
Outlook.ContactItem ci;
Outlook.Items i;
Outlook.UserProperty up;

ns=ola.GetNamespace("MAPI");

mf=ns.GetDefaultFolder(olFolderContacts); //ERROR occurs here

up=null;
i=null;
ci=null;
mf=null;
ns=null;
ola=null;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top