I wrote an addin for outlook, It will popup appointment's LastModificationTime while I click button
the button eventhandler like this
Outlook.ApplicationClass outlook = new Outlook.ApplicationClass();
Outlook.NameSpace ns = outlook.GetNamespace("MAPI");
Outlook.MAPIFolder folder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
Outlook.Items FolderItems = folder.Items;
DateTime MyDate = DateTime.Now;
List<Outlook.AppointmentItem> Appts = (
from Outlook.AppointmentItem i in folder.Items
where i.Start.Month == MyDate.Month && i.Start.Year == MyDate.Year
select i).ToList();
foreach (Outlook.AppointmentItem Appt in Appts)
{
System.Windows.Forms.MessageBox.Show(Appt.LastModificationTime.ToString());
}
the issue is happened while I changed appointment in my mobile phone, then sync it to the outlook through exchange server
steps which makes issue:
click button, get LastModificationTime as "time1"
change start date as "start1" in my mobile phone, sync to outlook through exchange server
click button, get LastModificationTime, still "time1"
change start date as "start2" in outlook, but the appointment is still in "start1" date.
restart outlook
click button, get new LastModificationTime as "time2", and appointment is in "start1" date, "start2" is gone.
steps without issue
- click button, get LastModificationTime as "time1"
1.1. restart outlook
change start date as "start1" in my mobile phone, sync to outlook through exchange server
click button, get LastModificationTime, "time2"
It looks like List Appts is never been refreshed to latest value if the appointment is changed through exchange server.
Is there any solution for this issue? or other reason to make it happened?