Thread: BCM 2007 events
View Single Post
  #4  
Old December 8th 06, 12:31 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default BCM 2007 events

1) Do somthing when ever a ContactItem (or Account) is created.

Subscribe to the MAPIFolder.Items.ItemAdd event for the desired folder(s). The sample at http://www.outlookcode.com/codedetail.aspx?id=456 is for the Sent Items folder, but it can supplement the information on that event in Help.

2) Do somthing when ever a ContactItem (or Account) is edited.


MAPIFolder.Items.ItemChange event. Another sample to supplement what's in Help: http://www.outlookcode.com/codedetail.aspx?id=566

3) Do somthing when ever a ContactItem (or Account) is deleted.


There's no surefire way to catch that until Outlook 2007. ContactItem.BeforeDelete fires only if the user has the item open and MAPIFolder.Items.ItemRemove doesn't return the item that was removed. One approach is to maintain your own list of what items are in each folder and check it against the actual folder contents whenever ItemRemove fires.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Aidal" wrote in message ...
Sue Mosher [MVP-Outlook] skrev:
You might want to start the documentation at http://msdn2.microsoft.com/en-us/library/aa431857.aspx. For events, you'll be using those exposed by the Outlook object model, so you might also find http://msdn.microsoft.com/vcsharp/de...ol03csharp.asp and http://www.outlookcode.com/codedetail.aspx?id=797 useful.


Ok, I've checked out the links and I also build the test add-in from one
of the links... So I did learn somthing and it was useful but still not
what I wanted.

I found from what I read and also tested a little that maybe Explorers
and Inspectors could be useful, but from what I saw, it's about the UI
areas and forms in Outlook not object events.

I did consider maybe one could access the "right" form and then find the
"right" button and then subscribe to it's Clicked event, using Explorers
or Inspectors, but if an object like an Account (which is infact an
Outlook.ContactItem) is accessible from other places than from the form
used for Accounts, then this method doesn't work, because the object
could be altered without ever openening the Account form hence making
the subscribtion to the Save- or SaveAndClose-button on the form
completely useless.

-------------------
So, if anyone could provide an example or a link to one that explains
how to:

1) Do somthing when ever a ContactItem (or Account) is created.
2) Do somthing when ever a ContactItem (or Account) is edited.
3) Do somthing when ever a ContactItem (or Account) is deleted.

I do realize that Created and Edited might infact just be "Saved" and
that would be ok as well.

Wether this be subscribing to pre-defined events (which I have been
unable to find), creating custom events or using whatever other means to
get a notification when these events (1, 2 and 3) occurres, doesn't
matter to me as long as it works and as long as it will always trigger
regardless of from where and by whom the object was altered.

/Aidal

Ads