469,299 Members | 2,065 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,299 developers. It's quick & easy.

Opening Outlook address book

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
4 13385

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
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

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
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.

Similar topics

2 posts views Thread by Phil Stanton | last post: by
4 posts views Thread by lauren quantrell | last post: by
reply views Thread by Bob Avallone | last post: by
reply views Thread by genojoe | last post: by
2 posts views Thread by hotelinfoline | last post: by
10 posts views Thread by Mike Miller | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.