|
Marco Dissel
Guest
|
I want to track the ItemOpen event and optionally cancel the event. It works fine for when a single item is selected in the Explorer, but not when multiple items are selected..
Is the ADXOutlookItemEvents class designed to track multiple items by calling ConnectTo multiple times? if not, i assume we need to create multiple instances of the ADXOutlookItemEvents class... What is the best way to do this?
Thanks
Marco |
|
Posted 05 Jul, 2008 10:21:38
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
Hello Marco,
Is the ADXOutlookItemEvents class designed to track multiple items by calling ConnectTo multiple times?
No, it isn't.
What is the best way to do this?
Looping through selected items, checking their types, and creating a new instance of the event class for every MailItem (for instance)?
Andrei Smolin
Add-in Express Team Leader |
|
Posted 07 Jul, 2008 03:14:04
|
|
Top
|
|
Marco Dissel
Guest
|
Looping through selected items, checking their types, and creating a new instance of the event class for every MailItem (for instance)?
What's the proper event to destroy the event classes? I want to be 100% sure to drop all references to COM instances.. Is there maybe a sample?
And a second question, how can you track this when no SelectionChange event is occuring (user select two items, choose Open Items and close the individually, choose again Open Item...-> no SelectionChange event...
Thanks
Marco |
|
Posted 07 Jul, 2008 09:27:22
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
Marco,
What's the proper event to destroy the event classes?
It depends on your logics only. I assume that you kill all of them in the next SelectionChange. Except, maybe for those items that has become open, forwarded, replied, etc.
I feel that your second question relates closely to the first one. If the item, events of which you are tracking, is closed, then you don't need to release it until the next SelectionChange.
Note also that Outlook allows opening an item without selecting it. Select an item, right-click another one, and open it.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 07 Jul, 2008 14:39:10
|
|
Top
|
|
Marco Dissel
Guest
|
Ok. But how can i catch ALL the possible methods to open an Item? When some property = true, i want to show my own custom view (= webpage) and close the default contact form
Thanks
Marco |
|
Posted 07 Jul, 2008 15:22:40
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
Marco,
Whatever way is used to open an item, the item generates the Open event. So, if you connect to the item and intercept the event, you can cancel it when it is required by your logics and show your form instead of the built-in one. Now, as you can see, the main point is connecting to the item before it generates the event. How you connect to (disconnect from) an item is determined by your logics.
Note also that Outlook allows opening an item without selecting it. Select an item, right-click another one, and open it.
This scenario doesn't allow using SelectionChange. Instead, you may want to connect to every item in the current folder. But it can be a huge load on Outlook.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 08 Jul, 2008 09:03:09
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
Marco,
You can try another approach. Handle the NewInspector event, get the item which is being opened, handle the item's Open event and cancel it in order to show your form.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 10 Jul, 2008 08:49:46
|
|
Top
|
|
Marco Dissel
Guest
|
Thanks, this seems to be working! |
|
Posted 11 Jul, 2008 06:05:59
|
|
Top
|
|