2016-07-25 36 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。 –