MAPI Store Accessor and multiple e-mails moved to a folder

Add-in Express™ Support Service
That's what is more important than anything else

MAPI Store Accessor and multiple e-mails moved to a folder
MAPI Store Accessor and multiple e-mails moved to a folder 
Danielle Wilcox

Posts: 10
Joined: 2011-05-18

I have been doing some basic development with the MAPI Store Accessor, and have run across an issue that I would like some advice on. I have a Solution Module that has several levels of folders. What I want to do is allow a user to drag-and-drop a group (more than 1) of mail items on one of these folders, which triggers the OnObjectMoved event. This is where the problem starts. It appears that this event is triggered for EACH of the mail items that were dropped on the folder, even though the mail items were moved as a group and dropped on the folder. Now, my idea for a solution would be to have a timer start running as soon as the first event arrives, and as these items arrives they get added to a form-level list. As each mail item arrives it will reset the timer. The final email arriving resets the timer for the last time, and once the timer runs out it actually triggers the logic I want to run for ALL of the emails that arrived. I dont like this solution, as it seems like a serious kludge, but I cant see a way around this, given the way the MAPI Accessor generates the OnObjectMoved event for each email dropped, not once for the entire group (with an array to represent all items dropped).

Any ideas or other options?

Posted 08 Jun, 2011 12:29:06 Top
Eugene Astafiev


Hi Danielle,

The OnObjectMoved event corresponds to the fnevObjectMoved notification in Extended MAPI. As a workaround you may try to use the ItemAdd event of the Items class in Outlook. But this event has a limitation:

This event does not run when a large number of items are added to the folder at once.

The MAPI Store Accessor was developed to bridge that gap ;-)

BTW Did you try to check out the selection in Outlook? The Selection class provides you with the Count property. Is it what you are looking for?
Posted 09 Jun, 2011 02:59:37 Top