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 » Outlook - Using Contacts
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

ContactItem.Save() --- Urgent Is their any Guru



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 28th 06, 07:21 AM posted to microsoft.public.outlook.contacts
Virda
external usenet poster
 
Posts: 13
Default ContactItem.Save() --- Urgent Is their any Guru


Hello All,

I have a problem related to ContactItem. Save().

I am using VS2005 C# with MSOffice2003 outlook.

I am working on a AddIn for Outlook.

As my Addin load in application start function. I call a function that
register following two events:

// Get object of Contacts folder.
Outlook.MAPIFolder contacts = ns.

GetDefaultFolder(Outlook.OlDefaultFolders.olFolder Contacts);

items = contacts.Items;

items.ItemChange += new
Outlook.ItemsEvents_ItemChangeEventHandler(
this.Items_ItemChange);

items.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(
this.Items_ItemAdd);

Now, Whenever any new Contact added to Outlook I assigned it a new
UserProperty of unique ID, to save this ID I have to call function

ContactItem.Save()

Without this any change doesn't save/remain in that contact.

As soon as the ContactItem.Save() executes
Sometimes it raises the events:

Outlook.ItemsEvents_ItemChangeEventHandler(CallFun c);

or

ItemsEvents_ItemAddEventHandler(CallFunc);

and this behaviour is not consistent, some time these events
raises continously and soem other day not.

I want to ask:

1. Why this event raises??
2. If this raises event then why it doesn't consistent??
3. Is their anyway I could skip or unregister this event??

Thanks In Advance!



  #2  
Old September 28th 06, 01:52 PM posted to microsoft.public.outlook.contacts
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default ContactItem.Save() --- Urgent Is their any Guru

I have a problem related to ContactItem. Save().

I am using VS2005 C# with MSOffice2003 outlook.

I am working on a AddIn for Outlook.

As my Addin load in application start function. I call a function that
register following two events:

// Get object of Contacts folder.
Outlook.MAPIFolder contacts = ns.

GetDefaultFolder(Outlook.OlDefaultFolders.olFolder Contacts);

items = contacts.Items;

items.ItemChange += new
Outlook.ItemsEvents_ItemChangeEventHandler(
this.Items_ItemChange);

items.ItemAdd += new
Outlook.ItemsEvents_ItemAddEventHandler(
this.Items_ItemAdd);

Now, Whenever any new Contact added to Outlook I assigned it a new
UserProperty of unique ID, to save this ID I have to call function

ContactItem.Save()

Without this any change doesn't save/remain in that contact.

As soon as the ContactItem.Save() executes
Sometimes it raises the events:

Outlook.ItemsEvents_ItemChangeEventHandler(CallFun c);

or

ItemsEvents_ItemAddEventHandler(CallFunc);

and this behaviour is not consistent, some time these events
raises continously and soem other day not.

I want to ask:

1. Why this event raises??


ItemChange fires because you're saving changes to an item.

2. If this raises event then why it doesn't consistent??


Maybe your code is running too fast? The underlying architecture doesn't fire the event if more than 16 items are changed at once. Or maybe you don't have items declared at the module level and the garbage collector is releasing it, so your event handlers no longer run.

3. Is their anyway I could skip or unregister this event??


I'm not a C# programmer, but I know it has a syntax for unregistering an event handler.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/comm....program_v ba

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

 




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
ContactItem.Save() Virda Outlook and VBA 9 January 10th 07 11:27 AM
Urgent Trés Urgent! Alain Philibin Outlook Express 7 September 28th 06 08:43 AM
Guru Help re Encrupted E-mails Sanjay Singh Outlook and VBA 1 March 16th 06 04:27 AM
New ContactItem with same EntryID jim Add-ins for Outlook 3 January 20th 06 07:01 PM
What makes a ContactItem unique jim Add-ins for Outlook 1 January 19th 06 03:14 PM


All times are GMT +1. The time now is 05:21 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.