![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
problem is whatever change is made in Contact folder's Contact Item I
capture the event 'ItemChange' and process that contactItem. In Contact Item Add event there is a need of my program to send data to server of perticular Contact Item after update the data I want to save it by using ContactItem.Save(). But, as soon as ContactItem.Save() function executed it raises the event ContactItemChanged. Due to this behaviour multiple times same data send to server. Is there any way I could prevent this behaviour? I am looking forward your answer. |
Ads |
#2
|
|||
|
|||
![]()
Look at the LastModificationTime property on the item. Use some sort of time
comparison so that unless a change hasn't occurred in x seconds or minutes you don't synch the item. Something like that is about all you can do. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Virda" wrote in message ... problem is whatever change is made in Contact folder's Contact Item I capture the event 'ItemChange' and process that contactItem. In Contact Item Add event there is a need of my program to send data to server of perticular Contact Item after update the data I want to save it by using ContactItem.Save(). But, as soon as ContactItem.Save() function executed it raises the event ContactItemChanged. Due to this behaviour multiple times same data send to server. Is there any way I could prevent this behaviour? I am looking forward your answer. |
#3
|
|||
|
|||
![]()
Hello Ken,
Thanks for your reply! I tried your recomended solution but it didn't work. Acutually during Sync/receiving all items from server I have to add into the Outlook 2003 along with a userproperty where we save its ID. After it I ahve to call ContactItem.Save(). As soon as this save() functin executed the ItemsEvents_ItemAddEventHandler evevt raises and inside this event handler we are sending this perticular item to server. Due to this cycle same data resend to server, that is wrong. IS there a way Icould disable this event or remove this event??? "Ken Slovak - [MVP - Outlook]" wrote: Look at the LastModificationTime property on the item. Use some sort of time comparison so that unless a change hasn't occurred in x seconds or minutes you don't synch the item. Something like that is about all you can do. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Virda" wrote in message ... problem is whatever change is made in Contact folder's Contact Item I capture the event 'ItemChange' and process that contactItem. In Contact Item Add event there is a need of my program to send data to server of perticular Contact Item after update the data I want to save it by using ContactItem.Save(). But, as soon as ContactItem.Save() function executed it raises the event ContactItemChanged. Due to this behaviour multiple times same data send to server. Is there any way I could prevent this behaviour? I am looking forward your answer. |
#4
|
|||
|
|||
![]()
I suppose you could remove whatever class you're using to handle the
ItemAdd/Change events and then re-instantiate it after doing your synching. Of course anything changed/added during that time would not be picked up then. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Virda" wrote in message ... Hello Ken, Thanks for your reply! I tried your recomended solution but it didn't work. Acutually during Sync/receiving all items from server I have to add into the Outlook 2003 along with a userproperty where we save its ID. After it I ahve to call ContactItem.Save(). As soon as this save() functin executed the ItemsEvents_ItemAddEventHandler evevt raises and inside this event handler we are sending this perticular item to server. Due to this cycle same data resend to server, that is wrong. IS there a way Icould disable this event or remove this event??? |
#5
|
|||
|
|||
![]() Thanks a lot Ken Slovak I think you are right but problem then How can I get the event from Outlook whenever user add/edit/delete any Contact/Task/Calendar item. Currectly I registered these calsses at ThisApplication_Startup. "Ken Slovak - [MVP - Outlook]" wrote: I suppose you could remove whatever class you're using to handle the ItemAdd/Change events and then re-instantiate it after doing your synching. Of course anything changed/added during that time would not be picked up then. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Virda" wrote in message ... Hello Ken, Thanks for your reply! I tried your recomended solution but it didn't work. Acutually during Sync/receiving all items from server I have to add into the Outlook 2003 along with a userproperty where we save its ID. After it I ahve to call ContactItem.Save(). As soon as this save() functin executed the ItemsEvents_ItemAddEventHandler evevt raises and inside this event handler we are sending this perticular item to server. Due to this cycle same data resend to server, that is wrong. IS there a way Icould disable this event or remove this event??? |
#6
|
|||
|
|||
![]() "Virda" wrote: Thanks a lot Ken Slovak I think you are right but problem is if I disable all these events then How can I get the event from Outlook in that case whenever user add/edit/delete any Contact/Task/Calendar item. Currectly I registered these calsses at ThisApplication_Startup. To get the any change related to Outlook Contact/Task/Calendar. Should I make the instances of these classes global and then reinitialize all these classes after sync process?? Thanks a lot Ken Slovak I think you are right but problem then How can I get the event from Outlook whenever user add/edit/delete any Contact/Task/Calendar item. Currectly I registered these calsses at ThisApplication_Startup. "Ken Slovak - [MVP - Outlook]" wrote: I suppose you could remove whatever class you're using to handle the ItemAdd/Change events and then re-instantiate it after doing your synching. Of course anything changed/added during that time would not be picked up then. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Virda" wrote in message ... Hello Ken, Thanks for your reply! I tried your recomended solution but it didn't work. Acutually during Sync/receiving all items from server I have to add into the Outlook 2003 along with a userproperty where we save its ID. After it I ahve to call ContactItem.Save(). As soon as this save() functin executed the ItemsEvents_ItemAddEventHandler evevt raises and inside this event handler we are sending this perticular item to server. Due to this cycle same data resend to server, that is wrong. IS there a way Icould disable this event or remove this event??? |
#7
|
|||
|
|||
![]()
I'd probably create a global collection to gather all my event handling
classes and keep them alive and then remove those collection members as they aren't needed or you need to de-reference them. Then I'd create a new class instance to handle the events and add it to the collection. Say on start synch you get rid of the class. Then on end of synch you instantiate a new instance. That would work. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Virda" wrote in message ... "Virda" wrote: Thanks a lot Ken Slovak I think you are right but problem is if I disable all these events then How can I get the event from Outlook in that case whenever user add/edit/delete any Contact/Task/Calendar item. Currectly I registered these calsses at ThisApplication_Startup. To get the any change related to Outlook Contact/Task/Calendar. Should I make the instances of these classes global and then reinitialize all these classes after sync process?? |
#8
|
|||
|
|||
![]() Thanks a lot Ken Slovak, Now the sync problem has removed the instantiate and uninstantiation logic of classes worked. But I didn't make the collecion. Now the problem is all my classes related to conact/task/calendar/ are instantiated in Application_start() of Addin. Wo, whenever I receive Contact add event I made changes to it and call ContactItem.Save(). by doing this the item_change event is raising If I unregister the event using items.ItemChange -= new Outlook.ItemsEvents_ItemChangeEventHandler(Func); then this event perminently removed. How could I overcome this problem, for the time being I used bool variables tok handle this situation. Also, Another problem is whenever birthday field set in contact item. the new activity added in calendar I want to remove this activity or it should not be added to calendar folder. If I try to remove it inside Contact item add evet, then at that time this activity not cteated. Thanks a lot again your kind cooperation and on time answers. "Ken Slovak - [MVP - Outlook]" wrote: I'd probably create a global collection to gather all my event handling classes and keep them alive and then remove those collection members as they aren't needed or you need to de-reference them. Then I'd create a new class instance to handle the events and add it to the collection. Say on start synch you get rid of the class. Then on end of synch you instantiate a new instance. That would work. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Virda" wrote in message ... "Virda" wrote: Thanks a lot Ken Slovak I think you are right but problem is if I disable all these events then How can I get the event from Outlook in that case whenever user add/edit/delete any Contact/Task/Calendar item. Currectly I registered these calsses at ThisApplication_Startup. To get the any change related to Outlook Contact/Task/Calendar. Should I make the instances of these classes global and then reinitialize all these classes after sync process?? |
#9
|
|||
|
|||
![]()
Can't you re-add your event handlers using the += syntax when you are
finished with your synch? Are the flags you're now using not working? If they are just keep using them. I'd probably not remove the event handlers but simply set a flag that says an update/move operation is in progress. If that flag is set then just exit the OnChange event without doing anything. If you remove the birthday setting by setting the date to None (1/1/4501) no reminder will be created and no recurring appointment for that birthday will be created. The same will apply to Anniversary. After the move you can then re-set the birthday/anniversary property as needed from your stored values and then handle the creation of the recurring appointments. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Virda" wrote in message ... Thanks a lot Ken Slovak, Now the sync problem has removed the instantiate and uninstantiation logic of classes worked. But I didn't make the collecion. Now the problem is all my classes related to conact/task/calendar/ are instantiated in Application_start() of Addin. Wo, whenever I receive Contact add event I made changes to it and call ContactItem.Save(). by doing this the item_change event is raising If I unregister the event using items.ItemChange -= new Outlook.ItemsEvents_ItemChangeEventHandler(Func); then this event perminently removed. How could I overcome this problem, for the time being I used bool variables tok handle this situation. Also, Another problem is whenever birthday field set in contact item. the new activity added in calendar I want to remove this activity or it should not be added to calendar folder. If I try to remove it inside Contact item add evet, then at that time this activity not cteated. Thanks a lot again your kind cooperation and on time answers. |
#10
|
|||
|
|||
![]()
hi vird,
I too have the same problem,the only difference is that you are inserting or sending the record in sqlserver and i am creating an xml file in itemChange. You said that you have controlled the multiple file creation using flag.If u can share the information with me about how you set the flag.that will be usefull for me. in my case both itemchange and explorer change is firing contiuosly after editing or modifying. pramod EggHeadCafe.com - .NET Developer Portal of Choice http://www.eggheadcafe.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
why wont outlook save my password when I select "save password" | Ala_Dom | Outlook - Installation | 1 | August 9th 06 06:03 PM |
Problem in changing ContactItem.Email1DisplayName | Carlos Martinez | Outlook and VBA | 0 | May 13th 06 02:22 PM |
when I save an email, where does it save to? | networm | Outlook - General Queries | 5 | March 15th 06 03:06 PM |
New ContactItem with same EntryID | jim | Add-ins for Outlook | 3 | January 20th 06 08:01 PM |
What makes a ContactItem unique | jim | Add-ins for Outlook | 1 | January 19th 06 04:14 PM |