outlook GetItems from MAPI calendar folder and Non cache Exchange mode

outlook GetItems from MAPI calendar folder and Non cache Exchange mode

I am writing a C++ code that should find all today meetings and analyze their busy status.

For retrieving Outlook ptr i use ::GetActiveObject.

For selecting appointments for today i use Outlook::MAPIFolderPtr::GetItems and Find() with filter "[Start] >= dd/mm/yy 00:00:00 AND [End]<= dd/mm/yy 23:59:00".

This code executed every minute on timer.

User that works with non cache Exchange mode on Outlook account settings after 10-15 minutes starts to get an error:

"Cannot open this item. Your server administrator has limited the number of items you can open simultaniously..."

I guess that somehow GetItems each time opens a lot of those items but does not close them, despite the fact all ptr are _COM_SMARTPTR_TYPEDEF (smart ptr that should be disposed at the end of use).

How can I explicitly close an opened items to avoid this error?

The error means you are running out of RPC channels because you are not releasing Outlook objects.

Please post the relevant snippet of your code that calls MAPIFolder::Find and processes the returned items.

Copyright © 2007-2012 www.chuibin.com Chuibin Copyright