Outlook VBA Out of Office - Setting a Date + Formatting

僤鯓⒐⒋嵵緔 提交于 2019-12-24 20:03:00

问题


im using Outlook 2013 and need help activating Out Of Office with VBA. I have trouble setting a starting and endtime as well as formatting my message. I seem not to be able to use html tags... Is there also a way of getting my current signature?

The code so far:

Sub absence(toggle As Boolean)

Const PR_OOF_STATE = "http://schemas.microsoft.com/mapi/proptag/0x661D000B"

Dim oStore As Outlook.Store, oProp As Outlook.PropertyAccessor
Dim oStorageItem As Outlook.StorageItem

Set oStorageItem = Application.Session.GetDefaultFolder(olFolderInbox).GetStorage("IPM.Note.Rules.OofTemplate.Microsoft", olIdentifyByMessageClass)

oStorageItem.Body = "<html><body><b>I am curerntly not available...</b></body></html>"

oStorageItem.Save


For Each oStore In Session.Stores
    If oStore.ExchangeStoreType = olPrimaryExchangeMailbox Then

        Set oProp = oStore.PropertyAccessor
        oProp.SetProperty PR_OOF_STATE, toggle 'If true: start OOF, if false: quit OOF

    End If
Next
Set olkIS = Nothing
Set olkPA = Nothing

End Sub

Anyone got an idea? Any help appreciated.


回答1:


HTML OOF replies and time ranges can only be set using EWS - see SetUserOofSettings operation on MSDN (https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/setuseroofsettings-operation)



来源:https://stackoverflow.com/questions/52703402/outlook-vba-out-of-office-setting-a-date-formatting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!