什么时候 MailItem 不是 MailItem? [英] When is a MailItem not a MailItem?

查看:35
本文介绍了什么时候 MailItem 不是 MailItem?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Outlook 的 Visual Basic(我们使用的是 Outlook 2003 和 Exchange Server)中编写了一个消息处理函数来帮助我整理收到的电子邮件.

I have written a message handler function in Outlook's Visual Basic (we're using Outlook 2003 and Exchange Server) to help me sort out incoming email.

它对我有用,只是有时规则失败并且 Outlook 将其停用.

It is working for me, except sometimes the rule fails and Outlook deactivates it.

然后我重新打开规则并在我的收件箱上手动运行它以赶上进度.该规则自发地失败并每天停用数次.

Then I turn the rule back on and manually run it on my Inbox to catch up. The rule spontaneously fails and deactivates several times a day.

我很想一劳永逸地解决这个问题.

I would love to fix this once and for all.

推荐答案

这段代码向我展示了收件箱中的不同类型名称:

This code showed me the different TypeNames that were in my Inbox:

Public Sub GetTypeNamesInbox()
Dim myOlItems As Outlook.Items
Set myOlItems = application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
Dim msg As Object

For Each msg In myOlItems
    Debug.Print TypeName(msg)
    'emails are typename MailItem
    'Meeting responses are typename MeetingItem
    'Delivery receipts are typename ReportItem
Next msg

End Sub

HTH

这篇关于什么时候 MailItem 不是 MailItem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆