Outlook.MAPIFolder: for each compile error

S

spareway

When I try to compile this:

foreach (Outlook.MAPIFolder tmpFolder in theFolder.Folders)
{
MesageBox.Show(tmpFolder.Name);
}


I get this:

foreach statement cannot operate on variables of type
'Outlook.Folders' because 'Outlook.Folders' does not contain a
definition for 'GetEnumerator', or it is inaccessible

Anyone know what is the problem?

thanks,

craig
 
K

Ken Slovak - [MVP - Outlook]

The problem is you can't use foreach, as the error says. Use a for loop
instead. It's actually faster anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top