K
Kulvinder
Hi,
I am getting the following error when i am trying to fetch the
AppointmentItem associated with a RecurrenceException in its Exceptions
collection :
You changed one of the recurrences of this item, and this instance no longer
exists. Close any open items and try again.
My code is as below :
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Outlook.NameSpace mapi = Application.GetNamespace("MAPI");
mapi.Logon(missing, missing, missing, missing);
Outlook.MAPIFolder folder =
mapi.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
try
{
foreach (Outlook.AppointmentItem item in folder.Items)
{
if (item.IsRecurring)
{
Outlook.RecurrencePattern pattern = item.GetRecurrencePattern();
foreach (Outlook.Exception exception in pattern.Exceptions)
{
Outlook.AppointmentItem exceptionItem = exception.AppointmentItem;
}
}
}
}
catch (Exception ex)
{
}
mapi.Logoff();
}
}
The error is coming in the line :
Outlook.AppointmentItem exceptionItem = exception.AppointmentItem;
Can anyone help me in this ?
Thanks
I am getting the following error when i am trying to fetch the
AppointmentItem associated with a RecurrenceException in its Exceptions
collection :
You changed one of the recurrences of this item, and this instance no longer
exists. Close any open items and try again.
My code is as below :
public partial class ThisAddIn
{
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Outlook.NameSpace mapi = Application.GetNamespace("MAPI");
mapi.Logon(missing, missing, missing, missing);
Outlook.MAPIFolder folder =
mapi.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
try
{
foreach (Outlook.AppointmentItem item in folder.Items)
{
if (item.IsRecurring)
{
Outlook.RecurrencePattern pattern = item.GetRecurrencePattern();
foreach (Outlook.Exception exception in pattern.Exceptions)
{
Outlook.AppointmentItem exceptionItem = exception.AppointmentItem;
}
}
}
}
catch (Exception ex)
{
}
mapi.Logoff();
}
}
The error is coming in the line :
Outlook.AppointmentItem exceptionItem = exception.AppointmentItem;
Can anyone help me in this ?
Thanks