Click here to Skip to main content
15,117,549 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am developing an Outlook 2007 Add-In using Visual Studio 2010, C#. The goal is to be able to select multiple contact folders, and each folder has multiple contacts within.

In the example below,[^]

I have two contact folders: Agency-WEST and Agency-EAST. Both contact folders have multiple contact items within.
Right now, if I want to send an e-mail to all people in my both contact folders, I have to go to the Agency-WEST folder first, select all contact items, then click the "New Message to Contact button" to have their email addresses appear in the To section of the Message window.

However, if I just use my mouse to click/select the Agency-WEST contact folder, the "New Message to Contact" won't be visible to click.

What I would like to do in my AddIn is to first be able to select/click one contact folder, then click the "New Message to Contact" button, then all contact items' email addresses inside that contact folder will be displayed onto the To section of the Message window.

After that, the second step is to be able to select more than one contact folders by holding down the Ctrl button, then click the "New Message to Contact" button, then all selected contact folders' e-mail addresses will be displayed onto the To section of the Message window.

From my understanding is that I cannot select more than 1 folder. Is there any alternatives to work this around?
Updated 11-Jul-11 15:41pm

1 solution

What do you mean "select ALL folders"? If not, can you provide a use case?

If you want to have access to all folders and other sources selected as address sources, use NameSpace.AddressLists. Each enumeration yields an AddressList which contain contacts.

See[^] for pointers.
Daniel0318 10-Jul-11 23:52pm
Hi Heath,
I have updated my question. Hope my explanation is clear enough.
Daniel0318 12-Jul-11 17:57pm
I have thought about another way of sending an email to batch recipients at once and would like to seek opinions if my theory makes sense.

Write a C#.NET add-in(program) that creates a button or a menu in the following process:

Step 1.
Create a new contact folder called combined-folder.

Step 2.
Copy all contact items of Agency-WEST that has email addresses into the combined-folder.
Then copy all contact items of Agency-EAST that has email addresses into the combined-folder as well.
Omit all fax numbers and those without email addresses.
Now we have one combined-folder has ALL contacts' email addresses.

Step 3.
The user can now use the mouse to select any one of the contact items in the combined-folder, press the Ctrl+A to select all contact items(emails), then the "New Message to Contact" button could be available to click, and all selected email addresses would automatically be copied to the To section of the Message window.

Would the above process be easier and more reasonable to implement?
Heath Stewart 12-Jul-11 18:24pm
I wouldn't mess with the users' folders. That could result in changes to their Exchange account or any other primary account. Instead, you could also use a search folder with global scope and a search filter like so: NOT emailaddresses:=[]
Daniel0318 14-Jul-11 3:18am
I thought Outlook 2007 does not support search folders for contact folder types. then how can I search for contact items?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900