3

I am using Outlook 2013 and I'm trying to figure out how to create a script to automate the process of enabling the OoO assistant for specific time range.

So far, I've created the script (you can see the corresponding function) below, which can successfully alter the text and enable the OoO assistant but I can't find if it is possible to set a specific time range.

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
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
afe
  • 43
  • 4
  • check this out ... https://stackoverflow.com/questions/12257985/outlook-vba-run-a-code-every-half-an-hour#15207463 ... – jsotola Jul 07 '17 at 02:22

1 Answers1

0

You could set up a daily recurring task/appointment, with a reminder and a unique subject.

In the ThisOutlookSession module

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

You could as well dismiss the reminder Dismiss Outlook reminder

Community
  • 1
  • 1
niton
  • 8,771
  • 21
  • 32
  • 52