Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Outlook AddIn
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,
http://98.130.241.249/project/img/02.jpg[^]
 
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?
Posted 9-Jul-11 13:46pm
Edited 11-Jul-11 15:41pm
v4

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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 http://msdn.microsoft.com/en-us/library/aa210893(v=office.11).aspx[^] for pointers.
  Permalink  
Comments
Daniel0318 at 10-Jul-11 23:52pm
   
Hi Heath,
I have updated my question. Hope my explanation is clear enough.
thanks.
Daniel0318 at 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 at 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 at 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)

  Print Answers RSS
0 OriginalGriff 428
1 Maciej Los 249
2 BillWoodruff 199
3 /\jmot 180
4 Suraj Sahoo | Coding Passion 150
0 OriginalGriff 8,484
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,159
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 11 Jul 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100