MAPI Developer: MAPI call (lpFolder)->OpenEntry() takes 2 minutes to open messages in mailbox

Recently I was working with a MAPI developer and came across this interesting issue. We noticed their custom MAPI application takes 2 minutes to open the messages in a given mailbox. Further troubleshooting we noticed they see this behavior with the MAPI call, (lpFolder)->OpenEntry(). It takes 2 minutes to open messages in a given mailbox and there is no error thrown. In order to isolate we used latest MFCMAPI and MAPI notifications, but we failed to locally repro the issue with it. We enabled good amount of logging from their custom MAPI app, Outlook environment (Advanced logging) and at the Exchange environment (Exchange logs) as well – but nothing helped much. Also this issue can be repro at will at this specific end customer environment.

We traced down the specific message – it contained .PDF files, which are password protected and we can access the attachment table and its attachments(.PDF files). While analyzing Exchange environment we noticed that they implemented an Anti-virus (AV) application and enabled detailed logging for database/mailbox/folder/mail/attachment levels to scan incoming/outgoing messages. Due to this, whenever we tried opening the message  using OpenEntry() call, it tries to scan the message, attachments – as PDF is password protected it tries to open thrice to scan the content  (which takes 2 minutes) and making the OpenEntry() call to wait till it finishes; so the MAPI call OpenEntry() call turned to be a victim. By modifying the respective Anti-virus rule, the issue was resolved the issue.

Hope this helps.

Skip to main content