Email as of type Outlook.MailItem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Outlook 2003

How to programmatically access e-mails in inbox, any users created folders
inside inbox or sent items as of type outlook.MailItem

Basically, I want to iterate through all the e-mails that are marked with
the yellow flag (in inbox, sent items and any folders created inside the
inbox)
 
Am Mon, 7 Aug 2006 09:16:02 -0700 schrieb css:

Sample for the Inbox:

Dim Mail As Outlook.MailItem
Dim Items As Outlook.MAPIFolder
Dim obj as Object

Set Items = Application.Session.GetDefaultFolder(olFolderInbox).Items

For Each obj In Items
If TypeOf obj Is Outlook.MailItem Then
Set Mail=obj
' check for the flag here
End If
Next

For sent items you can also use GetDefaultFolder with the proper constant. A
child folder of the Inbox e.g. would be, assuming you do have the Inbox
already:

Dim Folder as Outlook.Mapifolder
Set Folder = Inbox.Folders("ChildName")
 
Thanks you. Your approach works wery well.

I apologize I might have posted this multiple times.

One more question, how to process subfolders created within the inbox?
different user's will have folders created within the inbox and they
all can have different names?

Thanks in advance.
 
Am 10 Aug 2006 08:57:47 -0700 schrieb c_shah:

You can also loop through the subfolder with:

Dim Folder as Outlook.MapiFolder
For Each Folder in Inbox.Folders
....
Next
 
Back
Top