SavindraSingh
asked on
Automating OOO (out of office) Assistant in Outlook
This is with reference to an article written by user BlueDevilFan available at below link:
https://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/A_3487-Automating-Out-of-Office-in-Outlook.html?cid=239
I am looking for automating Microsoft Outlook 's OOO assistant so that it can automatically turn on/off the OOO assistant basis on the events/appointments saved on the outlook calendar.
For example:
If I have an all day event/appointment item stored on calendar with its BusyStatus set to olOutOfOffice. I was thinking about the event which will turn the OOO assistant on at the time given for this event/appointment in calendar and then automatically turn it off when the event/appointment time is ended.
While thinking on these lines I got an idea that this can be enabled when the Application_Reminder event gets triggered. So I had written below code in order to capture the event and then run the procedure to turn on OOO assistant.
By capturing the Application_Reminder events we can get reference to the current calendar item which has triggered the event and we can get below properties from it:
(1) Item.BusyStatus - Can be used to check if that is a out of office event
(2) Item.Body - Can be used to set the message that we need to put in OOO auto reply email message body
(3) Item.Location - Can be used to include this info in reply email message
(4) Item.Subject - Can be used to specify the subject line of reply email
(5) Item.StartInStartTimeZone - Can be used to specify the time when the OOO should turn on
(6) Item.EndInEndTimeZone - Can be used to specify the time when the OOO should turn off
But there are few constraints in doing this:
1) How to pass the Message body, Subject, Location etc info to be included in OOO email message, to the function/code provided by BDF
2) How can we turn off OOO at the time captured by Item.EndInEndTimeZone
Any help in this regard is highly appreciated.
https://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/A_3487-Automating-Out-of-Office-in-Outlook.html?cid=239
I am looking for automating Microsoft Outlook 's OOO assistant so that it can automatically turn on/off the OOO assistant basis on the events/appointments saved on the outlook calendar.
For example:
If I have an all day event/appointment item stored on calendar with its BusyStatus set to olOutOfOffice. I was thinking about the event which will turn the OOO assistant on at the time given for this event/appointment in calendar and then automatically turn it off when the event/appointment time is ended.
While thinking on these lines I got an idea that this can be enabled when the Application_Reminder event gets triggered. So I had written below code in order to capture the event and then run the procedure to turn on OOO assistant.
Sub OutOfOffice(bolState As Boolean)
Const PR_OOF_STATE = "http://schemas.microsoft.com/mapi/proptag/0x661D000B"
Dim olkIS As Outlook.Store, olkPA As Outlook.PropertyAccessor
For Each olkIS In Session.Stores
If olkIS.ExchangeStoreType = olPrimaryExchangeMailbox Then
Set olkPA = olkIS.PropertyAccessor
olkPA.SetProperty PR_OOF_STATE, bolState
End If
Next
Set olkIS = Nothing
Set olkPA = Nothing
End Sub
'Above code is provided by BDF and below code is written by me'
Private Sub Application_Reminder(ByVal Item As Object)
If Item.BusyStatus = olOutOfOffice Then
OutOfOffice True
End If
End Sub
By capturing the Application_Reminder events we can get reference to the current calendar item which has triggered the event and we can get below properties from it:
(1) Item.BusyStatus - Can be used to check if that is a out of office event
(2) Item.Body - Can be used to set the message that we need to put in OOO auto reply email message body
(3) Item.Location - Can be used to include this info in reply email message
(4) Item.Subject - Can be used to specify the subject line of reply email
(5) Item.StartInStartTimeZone - Can be used to specify the time when the OOO should turn on
(6) Item.EndInEndTimeZone - Can be used to specify the time when the OOO should turn off
But there are few constraints in doing this:
1) How to pass the Message body, Subject, Location etc info to be included in OOO email message, to the function/code provided by BDF
2) How can we turn off OOO at the time captured by Item.EndInEndTimeZone
Any help in this regard is highly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There is another problem with this approach.
I believe that the add-in code will stop working when the Outlook is not running this will prevent the code from turning on OOO if the users logoff before the OOO event occurs. Correct me if I am wrong.
I believe that the add-in code will stop working when the Outlook is not running this will prevent the code from turning on OOO if the users logoff before the OOO event occurs. Correct me if I am wrong.
That's correct. There is no client-side solution for this. If you want this functionality whether the user is logged in or not, then you'll have to develop a server-side solution. That's quite a bit more complicated.
ASKER
Thanks BDF I will continue with my research on server side solution. Your comments were very helpful.
ASKER
Need to think about sonthing else.
Ok.
ASKER
Open in new window
The above code can simply check the status of OOO while logging in to Outlook and turn it off if it is on.
Can you help me to extend it to sync it with Calendar events.
Regards,
Savindra