通过MAPI读取Exchange服务器时间

发布于 2024-07-07 01:01:57 字数 408 浏览 7 评论 0原文

我想计算 Exchange 邮箱中邮件的期限,以确保它们在我们的程序(C++、MAPI)处理它们之前至少在那里停留一分钟。 这样,我们使用的垃圾邮件过滤器应该有足够的时间来完成其工作。

因为我们的程序运行的PC上的时间可能与Exchange服务器使用的时间不同,所以我们的程序必须通过MAPI读取服务器时间。

有一个优雅的解决方案吗? 我能想到的一种方法是修改某些 Item 并立即读取其 PR_LAST_MODIFICATION_TIME ,但我想避免这种情况。

编辑:
我们的程序是一个批处理作业,每 10 分钟运行一次并读取日志邮箱。

I'd like to calculate the age of the messages in an Exchange mailbox to make sure they sit there for at least a minute before our program (C++, MAPI) processes them. This way the spam filter we use should have enough time to do its job.

Because the time on the PC where our program runs might be different from the time used by the Exchange server, our program has to read the server time via MAPI.

Is there an elegant solution to it? One way I can think of is to modify some Item and immediately read its PR_LAST_MODIFICATION_TIME, but I'd like to avoid that.

Edit:
Our program is a batch job that runs every 10 minutes and reads the journal mailbox.

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

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

发布评论

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

评论(2

我很坚强 2024-07-14 01:01:57

您可以使用PR_MESSAGE_DELIVERY_TIME

根据 MSDN

PR_MESSAGE_DELIVERY_TIME 属性描述消息在服务器上存储的时间,而不是传输提供商将消息从服​​务器复制到本地存储时的下载时间。

除此之外 - 当您的解决方案无论如何在客户端上运行时 - 为什么不首先使用客户端时间? 无论时钟是否正确,对于相对时间(例如“......之后一分钟”),这应该没有什么区别。

You can use PR_MESSAGE_DELIVERY_TIME.

As per MSDN:

The PR_MESSAGE_DELIVERY_TIME property describes the time the message was stored at the server, rather than the download time when the transport provider copied the message from the server to the local store.

Other than that - when your solution runs on the client anyway - why not use the client time in the first place? Incorrect clock or not, for relative times (e.g. "one minute after ...") this should make no difference.

千仐 2024-07-14 01:01:57

我假设当邮件到达 Exchange 邮箱时您会收到 MAPI 事件通知。 我建议将这些消息推送到队列中并等待 n 秒(例如 60 秒),然后再处理消息。 由于时间与通知事件相关,因此计算机之间的时钟漂移不会出现问题。

在启动应用程序时,您将被迫再次对现有消息执行此操作,但我不认为这会造成问题。

I presume you are getting a MAPI event notification when the message arrives in the Exchange mailbox. I would suggest pushing these messages into a queue and waiting n seconds (e.g. 60s) before processing the message. Since the time is relative to the notification event there will be no issue with respect to clock drift between the computers.

On start up of your application you would be forced to do this for existing messages again but I would not imagine that this would pose an issue.

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