423,485 Members | 1,648 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,485 IT Pros & Developers. It's quick & easy.

Opening Outlook address book

P: n/a
Hi NG!

Is there a way to open the Outlook address book dialog (as in Outlook) using
C#? I am using Outlook 2003 (MS Outlook 11.0 Object Library).
In Outlook 2007 it can be done with SenderNameDialog. I need to support both
versions.

Any hints?

TIA

Alex

Jul 25 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a

Here is how to open the Contacts list or Address book:

private Outlook.Application outlook;
private void button1_Click(object sender, System.EventArgs e)
{
try
{
outlook = new Outlook.Application();
Outlook.NameSpace mapiNamespace = outlook.GetNamespace("MAPI");
Outlook.MAPIFolder mapiFolder =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFo lders.olFolderContacts);
mapiFolder.Display();
}
catch(Exception ex)
{
Debug.WriteLine(ex.Message);
}
}

Adrian.
--
[Please mark my answer if it was helpful to you]


"Alexander Szigetvary" wrote:
Hi NG!

Is there a way to open the Outlook address book dialog (as in Outlook) using
C#? I am using Outlook 2003 (MS Outlook 11.0 Object Library).
In Outlook 2007 it can be done with SenderNameDialog. I need to support both
versions.

Any hints?

TIA

Alex

Jul 26 '07 #2

P: n/a
Hi Adrian,
private Outlook.Application outlook;
private void button1_Click(object sender, System.EventArgs e)
{
try
{
outlook = new Outlook.Application();
Outlook.NameSpace mapiNamespace = outlook.GetNamespace("MAPI");
Outlook.MAPIFolder mapiFolder =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFo lders.olFolderContacts);
mapiFolder.Display();
}
catch(Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
Not quite what I was looking for. I am trying to open the Outlook address
book, that shows the global address list and all outlook address book lists,
like subfolders to contacts or even public Exchange folders.

I know a way for Outllok 2007, but that doesn't work in Outlook 2003. So I'm
looking for that.

Alex

Jul 26 '07 #3

P: n/a

I'm not sure if that is possible with Outlook 2003 and earlier. I can't find
anything on the web relating to it but I could be wrong. You could just parse
the address list in code and fill up a list box with the contacts then handle
the double click event on the list box to add the user to an email.

Adrian.
--
[Please mark my answer if it was helpful to you]


"Alexander Szigetvary" wrote:
Hi Adrian,
private Outlook.Application outlook;
private void button1_Click(object sender, System.EventArgs e)
{
try
{
outlook = new Outlook.Application();
Outlook.NameSpace mapiNamespace = outlook.GetNamespace("MAPI");
Outlook.MAPIFolder mapiFolder =
mapiNamespace.GetDefaultFolder(Outlook.OlDefaultFo lders.olFolderContacts);
mapiFolder.Display();
}
catch(Exception ex)
{
Debug.WriteLine(ex.Message);
}
}

Not quite what I was looking for. I am trying to open the Outlook address
book, that shows the global address list and all outlook address book lists,
like subfolders to contacts or even public Exchange folders.

I know a way for Outllok 2007, but that doesn't work in Outlook 2003. So I'm
looking for that.

Alex

Jul 26 '07 #4

P: n/a
I'm not sure if that is possible with Outlook 2003 and earlier. I can't
find
anything on the web relating to it but I could be wrong. You could just
parse
the address list in code and fill up a list box with the contacts then
handle
the double click event on the list box to add the user to an email.
not quite the answer I hoped for, but thanks anyway.

In my first version I used CDO 1.21, which makes it easy to do that. My
problem is that the app just runs locally, but not when the exe is on a
network share (though the app is full trust).
And obviously MS says that CDO 1.x is not supported in managed code. Too bad
....

Alex

Jul 26 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.