Group:  Microsoft Outlook » microsoft.public.outlook.program_addins
Thread: Problem for getting the source item with ItemRemoveEventHandler

Geek News

Problem for getting the source item with ItemRemoveEventHandler
"Nico" <nico[ at ]AAA.fr> 5/23/2006 1:43:24 PM
Hello

I have a problem for getting the Appointment Item that has been remove
because there is no parameter allowed in the method call after an
ItemsEvents_ItemRemoveEventHandler. With ItemsEvents_ItemAddEventHandler and
ItemsEvents_ItemChangeEventHandler event I can find the AppointItem that has
been change or modify but how to find it with a ItemRemoveEventHandler event
?


Here is my code :

public void test(){

_application = new Outlook.Application();
_nameSpace = _application.GetNamespace("MAPI");
_mfCalendar =
_nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
ItemsEvents_ItemRemoveEventHandler iaehRemove =
new
ItemsEvents_ItemRemoveEventHandler(this.AppointmentItemRemove);
_itemsCalendar2.ItemRemove += iaehRemove;
}


public void AppointmentItemRemove()
{
// how to find here which Appointment item has been deleted ?
}

PS : I use Visual Studio 2005 with C#.

Thanks in advance


Re: Problem for getting the source item with ItemRemoveEventHandler
"Dave Kane [MVP - Outlook]" <dkane[ at ]mvps.org> 5/24/2006 3:19:12 AM
You'll need to add an ItemAdd handler to the Deleted Items folder to find
out which appointment was actually removed. Keep in mind that the
appointment's EntryID will have changed since it's in a new folder, so you
will need to use some other property to identify the item.

As you may know, Outlook 2003 SP2 made changes in the way calendar items are
handled (http://support.microsoft.com/?kbid=899919) From the article "The
new design works as follows. When a user accepts or tentatively accepts a
meeting, either from a meeting request or from a calendar item, the existing
calendar item is deleted from the calendar. Additionally, a duplicate of the
calendar item is created for the deleted item. Therefore, the new calendar
item has an Entry ID that is different from the Entry ID of the old calendar
item."

This means that your handlers may trap a delete and an add that are both for
the same appointment. The article describes how the Global Object ID
property is a more reliable way to track appointments. Unfortunately it's
not exposed by the Outlook object model, so you will need to use an Extended
MAPI library to get it.

"Nico" <nico[ at ]AAA.fr> wrote in message
news:OIoTe7mfGHA.2208[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
> Hello
>
> I have a problem for getting the Appointment Item that has been remove
> because there is no parameter allowed in the method call after an
> ItemsEvents_ItemRemoveEventHandler. With ItemsEvents_ItemAddEventHandler
> and ItemsEvents_ItemChangeEventHandler event I can find the AppointItem
> that has been change or modify but how to find it with a
> ItemRemoveEventHandler event ?
>
>
> Here is my code :
>
> public void test(){
>
> _application = new Outlook.Application();
> _nameSpace = _application.GetNamespace("MAPI");
> _mfCalendar =
> _nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
> ItemsEvents_ItemRemoveEventHandler iaehRemove =
> new
> ItemsEvents_ItemRemoveEventHandler(this.AppointmentItemRemove);
> _itemsCalendar2.ItemRemove += iaehRemove;
> }
>
>
> public void AppointmentItemRemove()
> {
> // how to find here which Appointment item has been deleted ?
> }
>
> PS : I use Visual Studio 2005 with C#.
>
> Thanks in advance
>
>


Re: Problem for getting the source item with ItemRemoveEventHandler
"Nico" <nico[ at ]AAA.fr> 5/24/2006 7:12:08 AM

Thanks for this clear answer !

"Dave Kane [MVP - Outlook]" <dkane[ at ]mvps.org> a écrit dans le message de
news: eR$TxBufGHA.3900[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
> You'll need to add an ItemAdd handler to the Deleted Items folder to find
> out which appointment was actually removed. Keep in mind that the
> appointment's EntryID will have changed since it's in a new folder, so you
> will need to use some other property to identify the item.
>
> As you may know, Outlook 2003 SP2 made changes in the way calendar items
> are handled (http://support.microsoft.com/?kbid=899919) From the article
> "The new design works as follows. When a user accepts or tentatively
> accepts a meeting, either from a meeting request or from a calendar item,
> the existing calendar item is deleted from the calendar. Additionally, a
> duplicate of the calendar item is created for the deleted item. Therefore,
> the new calendar item has an Entry ID that is different from the Entry ID
> of the old calendar item."
>
> This means that your handlers may trap a delete and an add that are both
> for the same appointment. The article describes how the Global Object ID
> property is a more reliable way to track appointments. Unfortunately it's
> not exposed by the Outlook object model, so you will need to use an
> Extended MAPI library to get it.
>
> "Nico" <nico[ at ]AAA.fr> wrote in message
> news:OIoTe7mfGHA.2208[ at ]TK2MSFTNGP05.phx.gbl...
>> Hello
>>
>> I have a problem for getting the Appointment Item that has been remove
>> because there is no parameter allowed in the method call after an
>> ItemsEvents_ItemRemoveEventHandler. With ItemsEvents_ItemAddEventHandler
>> and ItemsEvents_ItemChangeEventHandler event I can find the AppointItem
>> that has been change or modify but how to find it with a
>> ItemRemoveEventHandler event ?
>>
>>
>> Here is my code :
>>
>> public void test(){
>>
>> _application = new Outlook.Application();
>> _nameSpace = _application.GetNamespace("MAPI");
>> _mfCalendar =
>> _nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
>> ItemsEvents_ItemRemoveEventHandler iaehRemove =
>> new
>> ItemsEvents_ItemRemoveEventHandler(this.AppointmentItemRemove);
>> _itemsCalendar2.ItemRemove += iaehRemove;
>> }
>>
>>
>> public void AppointmentItemRemove()
>> {
>> // how to find here which Appointment item has been deleted ?
>> }
>>
>> PS : I use Visual Studio 2005 with C#.
>>
>> Thanks in advance
>>
>>
>
>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net