VSTO outlook data issue through exchange sync

Posted by cipheremix on Stack Overflow See other posts from Stack Overflow or by cipheremix
Published on 2010-04-19T01:57:21Z Indexed on 2010/04/19 2:03 UTC
Read the original article Hit count: 639

Filed under:
|
|
|

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:

  1. click button, get LastModificationTime as "time1"

  2. change start date as "start1" in my mobile phone, sync to outlook through exchange server

  3. click button, get LastModificationTime, still "time1"

  4. change start date as "start2" in outlook, but the appointment is still in "start1" date.

  5. restart outlook

  6. click button, get new LastModificationTime as "time2", and appointment is in "start1" date, "start2" is gone.

steps without issue

  1. click button, get LastModificationTime as "time1"

1.1. restart outlook

  1. change start date as "start1" in my mobile phone, sync to outlook through exchange server

  2. 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?

© Stack Overflow or respective owner

Related posts about outlook

Related posts about outlook-addin