M
Mathieu Maes
Hi everyone,
I'm developing an Outlook 2007 add-in to synchronize the Outlook
agenda with a webbased tool using a web service.
So far I'm able to import and export appointments from/to the web
service.
Now I'm stuck with deleted items. If a user deletes an appointment in
Outlook, and the add-in performs an import, it should be recreated.
I use following code to find a certain Outlook item:
private static AppointmentItem findOutlookItem(string olID)
{
try
{
Microsoft.Office.Interop.Outlook.Application Ol = new
Microsoft.Office.Interop.Outlook.Application();
MAPIFolder OlMapi = Ol.Session.GetDefaultFolder
(OlDefaultFolders.olFolderCalendar);
return (AppointmentItem)Ol.Application.GetNamespace
("MAPI").GetItemFromID(olID, OlMapi.StoreID);
}
catch (System.Exception ex)
{
ionPM.Logging.Write("ionSync.Core.findOutlookItem",
ex.ToString());
return null;
}
}
Whenever you delete an appointment in Outlook, it actually moves the
item to the "deleted items" folder.
In theory this code should return null, but the weird thing is that
above code still returns the (deleted) items, even though it's not
supposed to look in the "deleted items" folder!
I tried a workaround where I do a OlItem.Move
(Ol.Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar)), but
this method returns an exception with the message "Unable to perform
this action because the item is deleted".
The _AppointmentItem interface doesn't seem to have a variable that
can help me determine if the item is deleted or not.
Does anyone know how I can solve this ?
Kind regards,
Mathew
I'm developing an Outlook 2007 add-in to synchronize the Outlook
agenda with a webbased tool using a web service.
So far I'm able to import and export appointments from/to the web
service.
Now I'm stuck with deleted items. If a user deletes an appointment in
Outlook, and the add-in performs an import, it should be recreated.
I use following code to find a certain Outlook item:
private static AppointmentItem findOutlookItem(string olID)
{
try
{
Microsoft.Office.Interop.Outlook.Application Ol = new
Microsoft.Office.Interop.Outlook.Application();
MAPIFolder OlMapi = Ol.Session.GetDefaultFolder
(OlDefaultFolders.olFolderCalendar);
return (AppointmentItem)Ol.Application.GetNamespace
("MAPI").GetItemFromID(olID, OlMapi.StoreID);
}
catch (System.Exception ex)
{
ionPM.Logging.Write("ionSync.Core.findOutlookItem",
ex.ToString());
return null;
}
}
Whenever you delete an appointment in Outlook, it actually moves the
item to the "deleted items" folder.
In theory this code should return null, but the weird thing is that
above code still returns the (deleted) items, even though it's not
supposed to look in the "deleted items" folder!
I tried a workaround where I do a OlItem.Move
(Ol.Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar)), but
this method returns an exception with the message "Unable to perform
this action because the item is deleted".
The _AppointmentItem interface doesn't seem to have a variable that
can help me determine if the item is deleted or not.
Does anyone know how I can solve this ?
Kind regards,
Mathew