472,803 Members | 1,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,803 software developers and data experts.

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 13835

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Iain Miller | last post by:
Currently using & developing a new application in A97. This app has a lot of Name & Address information in it. A lot of that information will be duplicated in Outlook & I suddenly wondered if its...
2
by: Phil Stanton | last post by:
Can anyone give me sone code to add addresses from a query to an Outlook Address book. The problem is that I want to add the new email addresses to a distribution list, not to the main email list ...
4
by: lauren quantrell | last post by:
Is there a way to open the MS Outlook address book using VBA and then be able to do something with the return value? I want users to click an icon to open the Outlook address book then when an...
0
by: Bob Avallone | last post by:
MetaPro Systems Inc. Visual Studio Dot Net Tips & Tricks #3 Direct Access to Your Outlook Address Book. Project Type: VS.NET Windows Application Code Behind: Visual Basic I have a project...
0
by: genojoe | last post by:
I have seen examples of reading the contents of the MAPI folders in Outlook but I would like open the address book window instead so that the user can make selections directly from it. My code...
2
by: hotelinfoline | last post by:
I want to get outlook express (not microsoft outlook express) address book address's in visual basic application. Please tell how I can get.
0
by: mkhan | last post by:
Hi, i have been having trouble how to open the To Contacts list (address book) of a mail message in outlook using vb.net from where the user would be able to select a email address and would be...
1
by: Lpitt56 | last post by:
I am running MS Access 2007 and I want to update an Outlook Address book from my Access Database. I started out by importing the Outlook Address Book as a linked table and it linked fine. I then...
10
by: Mike Miller | last post by:
Hi, Am wanting to send email with php and need to access the global outlook address book. Are there any examples/tutorials on how to do this? M
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.