英文:
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.SentOn
和oEmailItem.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 byoEmailItem.Size
. - When a time value accessed from the table is null, such as a few of
oTableRow("SentOn")
and all ofoTableRow("ReminderTime")
, the value reported by the property directly, such asoEmailItem.SentOn
andoEmailItem.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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论