|
-
February 21st, 2010, 01:42 PM
#1
foreach loop problem.
Im havign an odd problem where a foreach loop that is supposed to delete all records only deletes half of the records.
foreach (Microsoft.Office.Interop.Outlook._ContactItem item in folder.Items)
{
item.Delete();
MessageBox.Show("contact gone");
}
the folder.Items is a MAPfolder ive created in outlook that has contacts inside it.
The loop will only delete half of the contacts from the folder. If I run the method twice, it then removes allof them. Why is this happening?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|