Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / January 2007

Tip: Looking for answers? Try searching our database.

Outlook.MAPIFolder: for each compile error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
spareway - 28 Jan 2007 18:16 GMT
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
Ken Slovak - [MVP - Outlook] - 29 Jan 2007 14:05 GMT
The problem is you can't use foreach, as the error says. Use a for loop
instead. It's actually faster anyway.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> When I try to compile this:
>
[quoted text clipped - 14 lines]
>
> craig
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.