![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I need to iterate through all of the contacts in a contact folder. I have
tried two methods to get the contacts out of a Contact folder: Here is the first code I've tried: Outlook.Application Outlook = new Outlook.Application(); Outlook.MAPIFolder fldContacts = (Outlook.MAPIFolder)Outlook.Session.GetDefaultFold er(OlDefaultFolders.olFolderContacts); foreach (Outlook.ContactItem oItem1 in fldContacts.Items) {//Get each contact...} I get the following complile error when I attempt the above: foreach statement cannot operate on variables of type 'Outlook.Items' because 'Outlook.Items' does not contain a public definition for 'GetEnumerator' Then I tried this approach: Outlook.ContactItem oItem; for (int j = 0; j oContactFolder.Items.Count; j++) { if (j == 0) oItem = (Outlook.ContactItem)oContactFolder.Items.GetFirst (); else oItem = (Outlook.ContactItem)oContactFolder.Items.GetNext( ); But with the above approach I'm getting the first contact, and a second, but from that point on it keeps returning the same second record (out of 20 total). Can anyone help me see what I am doing wrong here? It really shouldn't be that difficult to accomplish what I am trying to do here. Thanks!!!!!!!!! bob |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2003 - CONTACTS - Unable to display folder folder is full | Pearson385 | Outlook - Using Contacts | 7 | September 5th 09 02:22 PM |
Import contacts from Vista contact folder to outlook 2003 contacts | bikeguy55 | Outlook - Using Contacts | 1 | February 4th 09 05:51 PM |
How to convert 2003 personal folder contacts to Outlook 2007 | Carol | Outlook - Using Contacts | 2 | October 25th 07 03:57 PM |
Type Mismatch when iterating through eMail-folder MailItems in Outlook 2003 | [email protected] | Outlook and VBA | 3 | October 5th 07 02:45 PM |
How to share outlook 2003 customize contacts or contacts subfolder without do it on public folder? | Sue Mosher [MVP-Outlook] | Outlook - Using Contacts | 4 | June 28th 07 10:45 PM |