在MS Outlook VBA中,为什么电子邮件的属性在表格中与MailItem中报告不同?

huangapple go评论57阅读模式
英文:

In MS Outlook VBA, why are properties of an e-mail reported differenly by a table than by MailItem?

问题

这个问题涉及到我之前问题中发布的代码1

该例程输出Outlook文件夹中电子邮件的属性数据。它可以直接从MailItem对象(sLoopThru = "folder")获取数据,也可以从从文件夹构建的表对象sLoopThru = "table")获取数据。在该例程的输出中,根据使用的方法不同,我会得到以下差异:

  • 对于测试文件夹中的大多数电子邮件,oTableRow("Size") 报告的大小比 oEmailItem.Size 报告的大小小 16 字节。
  • 当从表格中访问的时间值为空时,比如一些 oTableRow("SentOn") 和所有 oTableRow("ReminderTime"),直接访问的属性的值,比如 oEmailItem.SentOnoEmailItem.ReminderTime,为 949998,Excel 自动格式化为奇怪的日期,4501年01月01日。

大小问题是最令人担忧的,因为它涉及到某些电子邮件的报告大小存在差异但并非所有电子邮件都有。时间戳问题只是奇怪。

造成大小差异的原因是什么?自从什么时候,4501年的第一天等同于空日期?

英文:

This question refers to the code posted in my previous question.

That routine outputs property data for the e-mails in an Outlook folder. It gets the data either directly from the MailItem object (sLoopThru = "folder") or from a table object built from the folder (sLoopThru = "table"). In the output of that routine, I get the following differences depending on which method is used:

  • For most of the e-mails in the tested folder, the size reported by oTableRow("Size") is 16 bytes less than that reported by oEmailItem.Size.
  • When a time value accessed from the table is null, such as a few of oTableRow("SentOn") and all of oTableRow("ReminderTime"), the value reported by the property directly, such as oEmailItem.SentOn and oEmailItem.ReminderTime, is 949998, which Excel automatically formats as the strange date, 4501 01 01.

The size issue is the most concerning because it's a discrepancy in the size reported for some but not all e-mails. The timestamp issue is just weird.

What is the cause of the size discrepancy and since when is the first day of the year 4501 equivalent to a null date?

答案1

得分: 1

1/1/4501 是 OOM 中的特殊日期,意味着没有数据,因为无法从 DateTime 属性返回 null(它是标量)。

大小报告由提供程序决定 - 它是所有属性的大小加上存储这些属性所需的任何内容。

英文:

1/1/4501 is a special date in OOM meaning there is no data, since you cannot return null from a DateTime property (it is scalar).

How size is reported is up to the provider - it is the size of all properties plus whatever is necessary to store those properties.

huangapple
  • 本文由 发表于 2023年5月25日 02:16:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76326390.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定