But, now that you're done building your workflow you notice when people are out the the office or 'OOF' (Why is it OOF and not OOO? The Exchange Team @Microsoft explains) it breaks down. So, if you want something else to happen, like assign the task to another individual or kick off another workflow perhaps? Well then, I've got something that will be right up your alley!
By using a simple web service call, we can query the EWS (Exchange Web Services) of your Office 365 tenancy to find out if someone's OOF settings are enabled or not as well as the start and end dates for when they'll be out.
So first thing's first. We need to call the classic Exchange Online method (outlook.office365.com/EWS/Exchange.asmx) using the Web Request action. Keep in mind that the authorizing user needs to have the appropriate permissions* on the mailbox to perform this query.
Here is the body of the EWS call that you will need to use:
<?xml version="1.0" encoding="UTF-8"?>
*NOTE- You must have full control delegation of the mailbox you are querying enabled for the account that will be making the Web Request otherwise you will receive an 'Access Denied' error. Check out the following link on using PowerShell to delegate the mailbox to your service account: TechNet Exchange Online Cmdlets (Add-MailboxPermission)
The Exchange Online response will look something like this:
<?xml version="1.0" encoding="utf-8" ?>
<t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="685" MinorBuildNumber="8"
<Message>I am out of office. This is my internal reply.</Message>
<Message>I am out of office. This is my external reply.</Message>
So now you'll need to parse out (Xpath) the XML using the Query XML action to get the OofState and store it into a Collection variable. The node we're looking for is '//defaultNS:OofState'.
At this point I decided to leverage a Conditional Branch action to (if OOF is on) get the start and end dates and store them to variables using additional Query XML actions. I am not including their configuration as the workflow can be downloaded below. I could use this information to decide if I really want to not send the task to this individual (I would probably assign the task if they'll be in tomorrow but not if they're out for another two weeks).
In conclusion, using Nintex Workflow for Office 365 in conjuction with the API's available for various Microsoft cloud platforms can be a powerful combination for automating your various business processes!
The workflow that I built for this blog post is attached below: