Skip to main content

outofofficebanner.jpgSo you've decided to automate a process in Office 365 with Nintex Workflow... excellent decision!

 

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.

144828_pastedImage_4.png

Here is the body of the EWS call that you will need to use:

 

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/
" xmlns:xsd="
http://www.w3.org/2001/XMLSchema
" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
">

   <soap:Body>
      <GetUserOofSettingsRequest xmlns="
http://schemas.microsoft.com/exchange/services/2006/messages
">

         <Mailbox xmlns="
http://schemas.microsoft.com/exchange/services/2006/types
">

            <Address>
EMAILADDRESSTOQUERY
@domain.onmicrosoft.com
</Address>

         </Mailbox>
      </GetUserOofSettingsRequest>
   </soap:Body>
</soap:Envelope>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 

*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" ?>
<soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/
"

  xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
"

  xmlns:xsd="
http://www.w3.org/2001/XMLSchema
">

  <soap:Header>
  <t:ServerVersionInfo MajorVersion="8" MinorVersion="0" MajorBuildNumber="685" MinorBuildNumber="8"
  xmlns:t="
http://schemas.microsoft.com/exchange/services/2006/types
" />

  </soap:Header>
  <soap:Body>
  <GetUserOofSettingsResponse xmlns="
http://schemas.microsoft.com/exchange/services/2006/messages
">

  <ResponseMessage ResponseClass="Success">
  <ResponseCode>NoError</ResponseCode>
  </ResponseMessage>
  <OofSettings xmlns="
http://schemas.microsoft.com/exchange/services/2006/types
">

  <OofState>Disabled</OofState>
  <ExternalAudience>All</ExternalAudience>
  <Duration>
  <StartTime>2006-11-03T23:00:00</StartTime>
  <EndTime>2006-11-04T23:00:00</EndTime>
  </Duration>
  <InternalReply>
  <Message>I am out of office. This is my internal reply.</Message>
  </InternalReply>
  <ExternalReply>
  <Message>I am out of office. This is my external reply.</Message>
  </ExternalReply>
  </OofSettings>
  <AllowExternalOof>All</AllowExternalOof>
  </GetUserOofSettingsResponse>
  </soap:Body>
</soap:Envelope>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 

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'.

144829_pastedImage_5.png

 

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).

 

145292_pastedImage_7.png

 

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:

this looks really good, but are you able to tell me if it would work with Nintex WF 2010?  Also would I just be able to create a SharePoint list just containing people's out of office?

Much appreciated

Claire


Hi,

we try to set any users out of office settings using SetUserOofSettings SOAP action. When we use credentials of the user to set it is working. We can't get any administrative account to work for all users - does anyone knows how to setup rights?

Thanks

Roman


Yes, TClaire Hodgson‌, this should work. There may be some nuance with the SOAP web requests depending on the version of Exchange and you would also be using the Call Web Service action in NWF2010.

Also, sure, you could certainly use a list in SharePoint to query users status but, since you're running NWF2010, you could just utilize the long term delegation that is built-in:

Delegating Approval Tasks (Scroll down to Setting personal delegation preferences)

http://help.nintex.com/en-US/nintex2010/help/#workflow/RootCategory/SharePoint/Nintex.Workflow.Delegation.htm%3FTocPath%… 


Hey Roman Mellenberger‌, you'll need to make sure your service account has been delegated full access rights to the mailbox. This TechNet documentation should help -> Add-MailboxPermission 


Reply