2016-07-25 33 views
2

Backgorund:
我需要发送预约,一切正常,不过,我想获得的Outlook.AppointmentItem一个“发送”财产,如果发出邀请与否 - 或者在用户点击显示的窗口或服务器问题后取消 - 。约会对象被送到


解决方案的尝试:
虽然我读了任命具有Saved Property这个-of课程 - 不告诉我,如果有人发送或不 - 样MailItem之一 - 。
我不认为提供的代码将是有益的,但是,在这里它是:
代码:

 
Dim olApp As Outlook.Application 
Dim olAgenda As Outlook.AppointmentItem 
Set olApp = New Outlook.Application 
Set olAgenda = olApp.CreateItem(1) 

With olAgenda 
    .Subject = "Test" 
    .Recipients.Add = "[email protected]" 
    .Display 
    On Error Resume Next 
    Call .ItemProperties.Item("Saved") 'here is where I would need to catch the kind of "was it sent?" variable. 

    If Err.Number = 0 Then    '99. If Error 
     MsgBox "Item Send" 
    Else        '99. If Error 
     MsgBox "Item Not Send" 
    End If        '99. If Error 

End With 

PS:请注意,我不喜欢后期绑定,对于后市库参考了被添加。
问题:
如果AppointmentItem被发送或没有发送,我该如何捕获?

回答

2

约会本身从不发送 - 它保留在日历文件夹中。只发送MeetingItem个对象。

这就是说,使用AppointmentItem.MeetingStatus属性。

+1

感谢它的工作!我必须补充说,当你使用它作为条件时,0意味着它“不可用” - 对于我的问题,outlook不能“发送” - 而且它可用。 – Sgdva

+2

有关olMeetingStatus枚举的可能值,请参阅https://msdn.microsoft.com/en-us/library/office/ff869427.aspx。 –