(Msg. 1) Posted: Wed Jun 24, 2009 10:13 am
Post subject: ItemChange Event to Propagate Contacts Archived from groups: microsoft>public>outlook>program_vba (more info?)
Hi,
I am trying to use the ItemChange event on Contacts.Items to execute VBA
code that will propagate the change to a contacts folder in my local PST file.
My question is two-part:
1. When I delete a contactitem from the contacts folder, the ItemChange
event fires and copies the deleted item to my PST file. How can I
distinguish the difference between changing an item or deleting an item using
VBA? If I also add code for the ItemRemove Event, will both events still
fire?
2. When I manually copy a contactitem from one folder to another it asks if
I want to update with changes or copy as a new item? When I propagate a
changed item using VBA, it adds the changed item as a new item rather than
merging the changed item with the existing item and doesn't give me an
option? Is there something I can do differently?
Sub ContactsFolder_ItemChange(ByVal Item As Object)
If InStr(Item.Categories, "Keyword") > 0 Then
Dim Destination_Folder As MAPIFolder
Set Destination_Folder = GetFolder("Mailbox - Keyword\Contacts")
Set ContactItemCopy = Item.Copy
ContactItemCopy.Move Destination_Folder
Else
Set Destination_Folder = GetFolder("Mailbox - Local\Contacts")
Set ContactItemCopy = Item.Copy
ContactItemCopy.Move Destination_Folder
End If
End Sub
(Msg. 2) Posted: Thu Jun 25, 2009 12:25 am
Post subject: Re: ItemChange Event to Propagate Contacts [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
1. I do not see ItemChange event firing whe na contact is deleted., no
matter whether I simply hit Delete or Shift+Delete. What do you see in
OutlookSpy (url below) if you go to the Contacts fodler, click Folde rbutton
on the OutlookSpy toolbar, select the Items property, click Browsse.
In the Items window, go to the Events tab. Now delete a contact. What do do
you see in the log?
2. Outlook performs the duplicate check only when you add a contact through
the UI. If you go through the Object Model, it never checks for duplicates
(not should it IMHO). Any duplicate checks are your reponsibility.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"C. Collings" <CCollings DeleteThis @discussions.microsoft.com> wrote in message
news:40242236-0E46-47DB-A86C-32EC4DA7D2CB@microsoft.com...
> Hi,
>
> I am trying to use the ItemChange event on Contacts.Items to execute VBA
> code that will propagate the change to a contacts folder in my local PST
> file.
>
> My question is two-part:
> 1. When I delete a contactitem from the contacts folder, the ItemChange
> event fires and copies the deleted item to my PST file. How can I
> distinguish the difference between changing an item or deleting an item
> using
> VBA? If I also add code for the ItemRemove Event, will both events still
> fire?
>
> 2. When I manually copy a contactitem from one folder to another it asks
> if
> I want to update with changes or copy as a new item? When I propagate a
> changed item using VBA, it adds the changed item as a new item rather than
> merging the changed item with the existing item and doesn't give me an
> option? Is there something I can do differently?
>
> Sub ContactsFolder_ItemChange(ByVal Item As Object)
> If InStr(Item.Categories, "Keyword") > 0 Then
> Dim Destination_Folder As MAPIFolder
> Set Destination_Folder = GetFolder("Mailbox - Keyword\Contacts")
> Set ContactItemCopy = Item.Copy
> ContactItemCopy.Move Destination_Folder
> Else
> Set Destination_Folder = GetFolder("Mailbox - Local\Contacts")
> Set ContactItemCopy = Item.Copy
> ContactItemCopy.Move Destination_Folder
> End If
> End Sub
>
> Thanks,
> Collings
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum