I'm trying to copy appointment items from a pst file to a subfolder of type calender in the users mailbox(as an archive). I'm also copying mail items and contacts and that works perfectly. What I'm doing is make a copy of each item and moves it to the new location. The destination MAPIFolder is a subfolder of the user mailbox with subfolders of type(s) olFolderInbox, olFolderCalendar and olFolderContacts
Microsoft.Office.Interop.Outlook.AppointmentItem clone = app.CreateItem((OlItemType.olAppointmentItem));
AppointmentItem source = item as AppointmentItem;
clone = source.Copy();
clone.Move(destination);
Some items are getting copied (eg. an recurring all day event) But most is not. Instead the code is creating multiple copies in the source calendar of the pst file!
The exception is thrown when calling source.Copy() The exception I get:
System.ArgumentException was caught _HResult=-2147024809
_message=Could not complete the operation. One or more parameter values are not valid.
HResult=-2147024809 IsTransient=false Message=Could not complete the operation.
One or more parameter values are not valid. Source=Microsoft Outlook StackTrace: at Microsoft.Office.Interop.Outlook._AppointmentItem.Copy()
at Program.cs:line 679 InnerException:
As mentioned the same code runs fine on mail and contact items and on some calendar items.
Driving me crazy!! Please help.
Thanks