我正在使用Outlook 2013,而我正试图弄清楚如何创建脚本以自动执行在特定时间范围内启用OoO助手的过程。
到目前为止,我已经创建了下面的脚本(你可以看到相应的功能),它可以成功地改变文本并启用OoO助手,但是我无法找到是否可以设置一个具体时间范围。
Private Function Set_OoO(Subs As String, M As String, oStores As Outlook.Stores, oStr As Outlook.Store, oPrp As Outlook.PropertyAccessor)
Dim oStorageItem As Outlook.StorageItem
Set oStorageItem = Application.Session.GetDefaultFolder(olFolderInbox).GetStorage("IPM.Note.Rules.O ofTemplate.Microsoft", olIdentifyByMessageClass)
oStorageItem.Body = "I am out of the office, please talk to " + Subs
oStorageItem.Save
For Each oStr In oStores
If oStr.ExchangeStoreType = olPrimaryExchangeMailbox Then
Set oPrp = oStr.PropertyAccessor
Call oPrp.SetProperty(M, True)
End If
Next
Set olkIS = Nothing
Set olkPA = Nothing
End Function
答案 0 :(得分:0)
OOF时间范围只能通过EWS设置,即使用UserOofSettings动词。无法使用Outlook对象模型或扩展MAPI进行设置。
如果使用Redemption是一个选项,它会公开RDOOutOfOfficeAssistant对象。由于它执行EWS呼叫,因此需要邮箱用户的凭据。
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
Session.Credentials.Add "*.myserver.com", "Domain\UserName", "MyPassword"
set OofAssistant = Session.Stores.DefaultStore.OutOfOfficeAssistant
OofAssistant.BeginUpdate
OofAssistant.StartTime = #12/21/2011#
OofAssistant.EndTime = #01/03/2012 9:00#
OofAssistant.State = 2 'rdoOofScheduled
OofAssistant.ExternalAudience = 1 'rdoOofAudienceKnown
OofAssistant.OutOfOfficeTextInternal = "<html><body>I am on vacation from 12/21/2001 until 01/03/2012. Please contact " & _
"<a href=""mailto:Joe.User@MyCompany.com"">Joe User</a>" & _
" if you have any questions</body></html>"
OofAssistant.OutOfOfficeTextExternal = "<html><body>I am on <b>vacation</b> until next year. </body></html>"
OofAssistant.EndUpdate
答案 1 :(得分:0)
您可以设置每日定期任务/约会,并提供提醒和独特的主题。
在ThisOutlookSession模块中
Option Explicit
Private Sub Application_Reminder(ByVal Item As Object)
If Item.MessageClass = "IPM.Task" Then
If Item.Subject = "Start OoO" Then
' call code to start OoO
ElseIf Item.Subject = "Stop OoO" Then
' call code to stop OoO
End If
End If
End Sub
您也可以解除提醒Dismiss Outlook reminder