Hannes de Jager
Hannes de Jager

Reputation: 2923

MAPI: How do I count the amount of folders in a mailbox

I've used MAPI on a project recently to traverse mailboxes and export them to .msg files so I know a bit but I would now like to efficiently count all the folders inside a mailbox. Can this be done with MAPI tables somehow? Is there a magic property for this? Any help will be appreciated.

Upvotes: 0

Views: 524

Answers (2)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66235

Normally you only get the immediate child folders. You can pass CONVENIENT_DEPTH flag to get all child folders returned. If I remember correctly, that will only work with the online Exchange stores (both mailbox and PF).

Upvotes: 1

kunal
kunal

Reputation: 966

Open the message store using OpenMsgStore function and then open top of information store using HrOpenFolderEx and then use GetHierarchyTable to get the list of folders

Upvotes: 1

Related Questions