为什么我的Outlook项目的创建时间属性返回任意日期?

发布于 2025-01-30 16:39:07 字数 511 浏览 1 评论 0原文

当我运行以下模块时,我将获得一个显示“ 1/1/4051”的消息框。

Sub CreateNoteItem()
 
    Dim olApp As Outlook.Application
    Dim olNS As Outlook.NameSpace
    Dim olNoteItm As Outlook.NoteItem

    Set olApp = Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    
    Set olNoteItm = olApp.CreateItem(olNoteItem)
    
    MsgBox olNoteItm.CreationTime
 
 End Sub

我期望的日期值,例如44701等,或类似于“现在”显示的字符串(m/dd/yyyy hh:mm:ss)。

这不仅是出于注释项目,还发生在邮寄项目中。我的最终目标是使用此创建时间,然后随后创建时间处理任何项目。

谢谢!

when I run the below module, I get a message box displaying "1/1/4051".

Sub CreateNoteItem()
 
    Dim olApp As Outlook.Application
    Dim olNS As Outlook.NameSpace
    Dim olNoteItm As Outlook.NoteItem

    Set olApp = Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    
    Set olNoteItm = olApp.CreateItem(olNoteItem)
    
    MsgBox olNoteItm.CreationTime
 
 End Sub

I was expecting a date value such as 44701, etc., or a string similar to when I display "Now" (m/dd/yyyy hh:mm:ss).

This happens not just for note items, but also mail items. My end goal is to use this creation time to then process any items with later creation times.

Thanks!

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

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

发布评论

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

评论(1

芯好空 2025-02-06 16:39:07

在获取任何特定日期的属性之前,请调用保存方法。

Sub CreateNoteItem()
 
    Dim olApp As Outlook.Application
    Dim olNS As Outlook.NameSpace
    Dim olNoteItm As Outlook.NoteItem

    Set olApp = Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    
    Set olNoteItm = olApp.CreateItem(olNoteItem)
    
    olNoteItm.Save
    
    MsgBox olNoteItm.CreationTime
 
 End Sub

Call the Save method before getting any date-specific properties.

Sub CreateNoteItem()
 
    Dim olApp As Outlook.Application
    Dim olNS As Outlook.NameSpace
    Dim olNoteItm As Outlook.NoteItem

    Set olApp = Outlook.Application
    Set olNS = olApp.GetNamespace("MAPI")
    
    Set olNoteItm = olApp.CreateItem(olNoteItem)
    
    olNoteItm.Save
    
    MsgBox olNoteItm.CreationTime
 
 End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文