Traversing the Inbox Folder
To cycle through all of the messages in the Inbox
-
Call IMsgStore::GetReceiveFolder to retrieve the entry identifier of the Inbox.
-
Call IMAPIFolder::OpenEntry to open the Inbox.
-
Call the Inbox's IMAPIContainer::GetContentsTable method to retrieve the contents table.
-
Call the contents table's IMAPITable::SetColumns method to limit the column set to PR_ENTRYID and any other columns you require.
-
Call IMAPITable::QueryRows to retrieve a group of rows.
-
Until there are no longer any rows in the contents table:
-
Call IMsgStore::OpenEntry to open the message represented by the entry identifier from each row.
-
Assign the lppUnk parameter to a local IMessage interface pointer.
-
Work with the properties of the message.
-
Release the pointer pointed to by the lppUnk parameter.
-
Call IMAPITable::QueryRows to retrieve the next group of rows.
-
Release the contents table.