Search code examples
phpexchangewebservicesphp-ews

Using PHP-EWS to update Automatic Replies (Out of Office)


I am attempting to develop a web interface using PHP which would allow any authorised user (specifically from the HR department) to update the Automatic Reply (Out of Office) of any active Exchange user/mailbox. I have successfully connected to the Exchange Web Services (Office 365) using php-ews (https://github.com/jamesiarmes/php-ews) and retrieved user mailbox configuration. However, I am unable to locate anything concerning Automatic Replies (Out of Office). Is there anyone who could provide examples or guidance on how this can be achieved?


Solution

  • You will need to use the GetUserOofSettings https://msdn.microsoft.com/en-us/library/office/aa563465(v=exchg.150).aspx and SetUserOofSettings https://msdn.microsoft.com/en-us/library/office/aa580294(v=exchg.150).aspx to do that in EWS. You will also need to use Impersonation to have the specific rights to do that make those changes https://msdn.microsoft.com/en-us/library/office/dn722377(v=exchg.150).aspx.

    If your using Office365 your other option is you can use the Graph API to also do the same thing https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_get_mailboxsettings which gets around any security hassles that EWS Impersonation might cause.