1
Vote

Error 8007000e when looping through many mailboxes

description

When a Powershell script is used to repeatedly call MAPIFolders against different mailboxes, it eventually starts throwing errors. First we see this:
Resolving mailbox: TestMbx1120@bilong.test
    PR_DISPLAY_NAME: TestMbx1120
    PR_ADDRTYPE: EX
    PR_EMAIL_ADDRESS: /o=First Organization/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=TestMbx1
120ba6
FAILED! hr = 8007000e.  LINE = 999
 >>> lpSession->OpenMsgStore( ulUIParam, lpEID->cb, (LPENTRYID) lpEID->lpb, NULL, ulFlags, (LPMDB*) lpMDB)
FAILED! hr = 8007000e.  LINE = 966
 >>> CallOpenMsgStore( lpMAPISession, NULL, &pRow->aRow[0].lpProps[EID].Value.bin, MDB_WRITE, lppDefaultMDB)
FAILED! hr = 8007000e.  LINE = 172
 >>> OpenDefaultMessageStore(lpSession, &lpDefaultMDB)
Failed to get root folder
FAILED! hr = 8004010f.  LINE = 22
 >>> OperationBase::Initialize()
FAILED! hr = 8004010f.  LINE = 162
 >>> exportSearchFoldersOp->Initialize()
Then:
Resolving mailbox: TestMbx1121@bilong.test
FAILED! hr = 80040201.  LINE = 140
 >>> lpAdrBook->ResolveName( 0L, fMapiUnicode, NULL, lpAdrList)
Failed to get root folder
FAILED! hr = 8004010f.  LINE = 22
 >>> OperationBase::Initialize()
FAILED! hr = 8004010f.  LINE = 162
 >>> exportSearchFoldersOp->Initialize()
This may be due to resources not being released.

comments

bilong wrote Jun 4, 2014 at 4:59 PM

Fixed in 0.3.8.0.

bilong wrote Jun 4, 2014 at 5:00 PM

** Closed by bilong 06/04/2014 9:00AM

bilong wrote Jun 4, 2014 at 8:35 PM

Scratch that. It seemed to work in my lab but it still reproducing sometimes.

bilong wrote Jun 4, 2014 at 11:37 PM

Turns out this only repros if Outlook, MfcMapi, or some sort of MAPI client is open. For now, work around it by closing all MAPI clients when running MAPIFolders in a loop.

The real solution here should be some way to feed MAPIFolders a list of mailboxes, so we can process a batch of mailboxes in one instance of MAPIFolders, instead of launching a new instance every time. That will probably solve this, not to mention make batch operations much easier to run, and we'd have one log file for the whole batch instead of a log file for every mailbox.