VSTO通过exchange同步发布outlook数据

发布于 2024-08-30 02:03:42 字数 1506 浏览 3 评论 0原文

我为 Outlook 编写了一个插件,当我单击

按钮事件处理程序时,它会弹出约会的 LastModificationTime,就像这样,

  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());
  }

当我在手机中更改约会时,会发生问题,然后通过交换服务器

步骤将其同步到 Outlook,这会导致问题:

  1. 点击按钮,获取LastModificationTime为“time1”

  2. 将手机中的开始日期更改为“start1”,通过exchange服务器同步到outlook

  3. 点击按钮,获取LastModificationTime,仍为“time1”

  4. 将开始日期更改为Outlook 中的“start2”,但约会仍处于“start1”日期。

  5. 重新启动 Outlook

  6. 单击按钮,获取新的 LastModificationTime 为“time2”,约会是在“start1”日期,“start2”已消失。

步骤没有问题

  1. 单击按钮,将 LastModificationTime 获取为“time1”

1.1。重新启动 Outlook

  1. 在手机中将开始日期更改为“start1”,通过 Exchange 服务器同步到 Outlook

  2. 单击按钮, get LastModificationTime, "time2"

看起来像 列出应用程序 如果通过交换服务器更改约会,则永远不会刷新为最新值。

这个问题有什么解决办法吗?或其他原因使其发生?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

海拔太高太耀眼 2024-09-06 02:03:42

没有看到您其他代码,但您需要记住释放约会对象
Marshal.ReleaseComObject。
另外,您的客户端 Outlook 是否处于缓存模式?

马库斯

Not seeing you other code, but you need to remember to release the appointment objects
Marshal.ReleaseComObject.
Also is your client outlook in cache mode?

Marcus

開玄 2024-09-06 02:03:42

我遇到了同样的问题,这是我的解决方案:

使用:

Outlook.Folder calFolder = outlookApplication.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;

而不是:

Outlook.MAPIFolder folder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

区别是 Outlook.MAPIFolder 和 Outlook.Folder,我不知道为什么,但 Outlook.Folder 对我有用。

I've had same issue, and this is my solution:

Use:

Outlook.Folder calFolder = outlookApplication.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;

Instead of:

Outlook.MAPIFolder folder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

The difference is Outlook.MAPIFolder and Outlook.Folder, I don't known why but Outlook.Folder works for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文