A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

BCM 2007 events



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 6th 06, 10:28 AM posted to microsoft.public.outlook.program_addins
Aidal
external usenet poster
 
Posts: 9
Default BCM 2007 events

Hi NG.

I'm trying to write an application or add-in that has to act on some
events from BCM for Outlook 2007.

The events i'm interested in are events like Created, Updated and
Deleted on entities/objects like Accounts, Contacts etc. (most of which
are ContactItem objects).

I have been able to find "some" events on the ContactItem object but far
from enough to satisfy my needs.

I would very much like to know:
-------------------------------
1) Where do I find these events (what objects should I be looking at if
not ContactItem) ?

2) How do I go about writing and adding these eventhandlers (I've seen
an example in VBA but not for the objects I'm interested in and
everything I've tried with any existing event on the objects of my
interest have not been successful) ?
-------------------------------
I write in C# myself. If anyone can answer any of these questions and
maybe even supply code examples or links to some "useful" examples it
would be very much appreciated, thanks

/Aidal



Ads
  #2  
Old December 6th 06, 01:11 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default BCM 2007 events

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.

--
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 ...
Hi NG.

I'm trying to write an application or add-in that has to act on some
events from BCM for Outlook 2007.

The events i'm interested in are events like Created, Updated and
Deleted on entities/objects like Accounts, Contacts etc. (most of which
are ContactItem objects).

I have been able to find "some" events on the ContactItem object but far
from enough to satisfy my needs.

I would very much like to know:
-------------------------------
1) Where do I find these events (what objects should I be looking at if
not ContactItem) ?

2) How do I go about writing and adding these eventhandlers (I've seen
an example in VBA but not for the objects I'm interested in and
everything I've tried with any existing event on the objects of my
interest have not been successful) ?
-------------------------------
I write in C# myself. If anyone can answer any of these questions and
maybe even supply code examples or links to some "useful" examples it
would be very much appreciated, thanks

/Aidal



  #3  
Old December 8th 06, 08:30 AM posted to microsoft.public.outlook.program_addins
Aidal
external usenet poster
 
Posts: 9
Default BCM 2007 events

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
  #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

  #5  
Old December 11th 06, 10:18 AM posted to microsoft.public.outlook.program_addins
Aidal
external usenet poster
 
Posts: 9
Default BCM 2007 events

Sue Mosher [MVP-Outlook] skrev:
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.

Thanks for your reply Sue.

I will try this out right away.

By the way, about the "deleted" event, it is infact Outlook + BCM 2007
I'm developing for.


/Aidal
  #6  
Old December 11th 06, 12:23 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default BCM 2007 events

Sorry, I missed that. For Outlook 2007, you can use the Folder.BeforeItemMove event.

--
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 ...

By the way, about the "deleted" event, it is infact Outlook + BCM 2007
I'm developing for.


  #7  
Old December 11th 06, 12:44 PM posted to microsoft.public.outlook.program_addins
Aidal
external usenet poster
 
Posts: 9
Default BCM 2007 events

Sue Mosher [MVP-Outlook] skrev:
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.


Ok, I've checked out your example. I'm not sure I've translated your
code correctly to C# though.

I've created my own little class to test and am trying to use it from a
console application.
-----------------------------------
// available within the class
Outlook.ApplicationClass olAppClass;
Outlook.NameSpace olNameSpace;
Outlook.Folders olFolders;
Outlook.MAPIFolder olBcmRootFolder;

// Within my class constructor
olAppClass = new Outlook.ApplicationClass();
olNameSpace = olAppClass.GetNamespace("MAPI");
olFolders = olNameSpace.Session.Folders;
olBcmRootFolder = olFolders["Business Contact Manager"];

olBcmRootFolder.Folders["Accounts"].Items.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(InstanceAd ded_Account);

// No longer within constructor
public void InstanceAdded_Account(object item)
{
Console.WriteLine("account created: " +
((Outlook.ContactItem)item).FullName);
}
-----------------------------------
This should give me some console output when an Account is created or am
I missing somthing here?

Does the delegate have to have a certain name in order for it to work maybe?

/Aidal
  #8  
Old December 11th 06, 01:35 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default BCM 2007 events

That's on the right track but needs some refinement. You must to declare an explicit Items object at the class level, instantiate it in your procedure, and then create the event handler. The Items object must be a class-level object in order to persist so that it can fire events.

--
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:
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.


Ok, I've checked out your example. I'm not sure I've translated your
code correctly to C# though.

I've created my own little class to test and am trying to use it from a
console application.
-----------------------------------
// available within the class
Outlook.ApplicationClass olAppClass;
Outlook.NameSpace olNameSpace;
Outlook.Folders olFolders;
Outlook.MAPIFolder olBcmRootFolder;

// Within my class constructor
olAppClass = new Outlook.ApplicationClass();
olNameSpace = olAppClass.GetNamespace("MAPI");
olFolders = olNameSpace.Session.Folders;
olBcmRootFolder = olFolders["Business Contact Manager"];

olBcmRootFolder.Folders["Accounts"].Items.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(InstanceAd ded_Account);

// No longer within constructor
public void InstanceAdded_Account(object item)
{
Console.WriteLine("account created: " +
((Outlook.ContactItem)item).FullName);
}
-----------------------------------
This should give me some console output when an Account is created or am
I missing somthing here?

Does the delegate have to have a certain name in order for it to work maybe?

/Aidal

  #9  
Old December 13th 06, 08:09 AM posted to microsoft.public.outlook.program_addins
Aidal
external usenet poster
 
Posts: 9
Default BCM 2007 events

Sue Mosher [MVP-Outlook] skrev:
That's on the right track but needs some refinement. You must to declare an explicit Items object at the class level, instantiate it in your procedure, and then create the event handler. The Items object must be a class-level object in order to persist so that it can fire events.


Ok, now I have this. I've created an Outlook.Items object like you
described, and attatched the event handler to that object - but it still
doesn't have any effect.
I still get no message in my console when an Account is created :/

To me the syntax here makes sense so either I'm very close or I'm just
misunderstanding your descriptions.
-----------------------------------------------
// class variables
private Outlook.ApplicationClass appClass;
private Outlook.Application app;
private Outlook.NameSpace nameSpace;
private Outlook.Folders folders;
private Outlook.MAPIFolder bcmRootFolder;
private Outlook.Items olItems;

// in constructor
this.appClass = new Outlook.ApplicationClass();
this.app = (Outlook.Application)this.appClass;
this.nameSpace = this.appClass.GetNamespace("MAPI");
this.folders = this.nameSpace.Session.Folders;
this.bcmRootFolder = this.folders["Business Contact Manager"];

this.olItems = this.bcmRootFolder.Folders["Accounts"].Items;
this.olItems.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(InstanceAd ded_Account);

// outside constructor
public void InstanceAdded_Account(object item)
{
Console.WriteLine("ACCOUNT CREATED: " +
((Outlook.ContactItem)item).FullName);
}
-----------------------------------------------

/Aidal
  #10  
Old December 13th 06, 01:08 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default BCM 2007 events

Sorry, I don't write C# code, so I can't tell you why it's not working. From my limited ability to read C#, no problem jumps out at me.

--
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:
That's on the right track but needs some refinement. You must to declare an explicit Items object at the class level, instantiate it in your procedure, and then create the event handler. The Items object must be a class-level object in order to persist so that it can fire events.


Ok, now I have this. I've created an Outlook.Items object like you
described, and attatched the event handler to that object - but it still
doesn't have any effect.
I still get no message in my console when an Account is created :/

To me the syntax here makes sense so either I'm very close or I'm just
misunderstanding your descriptions.
-----------------------------------------------
// class variables
private Outlook.ApplicationClass appClass;
private Outlook.Application app;
private Outlook.NameSpace nameSpace;
private Outlook.Folders folders;
private Outlook.MAPIFolder bcmRootFolder;
private Outlook.Items olItems;

// in constructor
this.appClass = new Outlook.ApplicationClass();
this.app = (Outlook.Application)this.appClass;
this.nameSpace = this.appClass.GetNamespace("MAPI");
this.folders = this.nameSpace.Session.Folders;
this.bcmRootFolder = this.folders["Business Contact Manager"];

this.olItems = this.bcmRootFolder.Folders["Accounts"].Items;
this.olItems.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(InstanceAd ded_Account);

// outside constructor
public void InstanceAdded_Account(object item)
{
Console.WriteLine("ACCOUNT CREATED: " +
((Outlook.ContactItem)item).FullName);
}
-----------------------------------------------

/Aidal

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BCM 2007 Events and EventHandlers Aidal Outlook - General Queries 1 December 6th 06 01:15 PM
Installed Office 2007 Pro, BCM is not there, how to get module? blewis999 Outlook - Using Contacts 0 November 23rd 06 03:29 AM
BCM crashed - reinstalled - now I can't see BCM in Oulook CGINUSA Outlook - Installation 0 July 18th 06 10:06 AM
Migrating BCM files from 2003 to 2007 JimB Outlook - Installation 1 July 16th 06 02:18 PM
Outlook 2007 w/BCM: Cannot Reinstall RDU Outlook - Installation 0 July 2nd 06 04:05 PM


All times are GMT +1. The time now is 08:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.