Traversing the Inbox Folder

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