Iterating Outlook Contacts

. . posted at 04-Oct-06 05:02

Hi there!, I have this very strange problem:

I want to iterate through Outlook contacts located in a public folder, but iteration stops randomly giving different error codes, among them these ones: -833601531, -695189499, -625983483, -37732347. Everytime I get the same text message: "The operation failed".

for (int i = 1; i <= mexicoContacts.Items.Count; i++)
{

if (mexicoContacts.Items[i] is Outlook.ContactItem)
{
Outlook.ContactItem contact = (Outlook.ContactItem)mexicoContacts.Items[i];
if (contact.LastName != null)
listBox1.Items.Add(contact.LastName);
}


}

Any Ideas?

Thanks...


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  Iterating Outlook Contacts - . .  04-Oct-06 05:02 5:02:38 PM
      InnerException - F Cali  04-Oct-06 05:20 5:20:01 PM
          COMException - . .  04-Oct-06 05:55 5:55:30 PM
              0-Based - F Cali  04-Oct-06 05:59 5:59:12 PM
                  166 but no 165 - . .  04-Oct-06 06:07 6:07:38 PM
                      Skip Erroneous Items - F Cali  04-Oct-06 06:10 6:10:01 PM
                          Sounds easy but... - . .  04-Oct-06 06:24 6:24:13 PM
                              try/catch inside for loop - F Cali  04-Oct-06 06:26 6:26:39 PM
                                  Hey!!! - . .  04-Oct-06 06:33 6:33:49 PM
View Posts