Set automatic Replies for Other Users Step by Step


Are you also tired of all the things you have to take care of when you are out of office for holidays, illness, etc?
We recently built a solution within Powerapps and PowerAutomate that allows you to simply select the Start/End date of your absence and your preferred substitute for that time.The App and Flows then will do all the necessary work for you while you can sit back and relax :) So far our solution manages the following:
  • Posting a clickable message in Teams to your preferred substitute via PowerAutomate and sending back the response to the requestor.
  • Create a Calendar-Entry in Outlook
  • Create Entries in Dynamics 365 for every day, leaving out weekend and fixed holidays
  • Inform HR and additional Teams of your Choice via Message (Adaptive Card) in Teams
  • AND: Setting up the Automatic-Replies in Outlook for all Users in your Organization

(Note that only the last part is covered in this Post. If you are interested in the other ones, just leave a comment)

What we will do

  1. Show the App-Registration in Azure AD to be able to use the OAuth-Token with the MS Graph Api in PowerAutomate afterwards. 
  2. Set up the necessary permissions for the MS-Graph Api to be able to change automatic replies for other users than yourself.
  3. Create a Flow in PowerAutomate from scratch that runs on a daily basis and sets up the automatic replies for a user when the startdate of an absence-entry in a SharePoint List is equal to today's date.


  1. You need to be a global admin to be able to do the App-Registration and set the mailbox settings for other users or convince the global admin to do the necessary steps for you. (Should be no problem, because this solution is as easy as it is awesome : )
  2. PowerAutomate license for HTTP-Request (Premium-Connector)
  3. Create a SharePoint List or use an existing one with at least a date column and a text column (for the user's email address).

1. App-Registration

  1. Login to the Azure Portal and go to Azure Active Directory > choose App Registrations
  2. Click on the Plus-Symbol for new Registration
  3. Simply select a proper name and select accounts in this organizational directory only for the supported account type. You can leave out the platform configuration. That´s it, the overview shows the following:

2. Set up Permissions

  1. Navigate to API Permissions in the menu. Click on Add a Permission. Choose Microsoft Graph and then Application permissions (as we don´t want to have a signed in user).
  2. Search for MailboxSettings.ReadWrite ,select it and click on Add Permissions. (You will receive an info that the changes need admin consent and that the changes are not yet granted for your tenant).
  3. In the API permissions screen (same screen) you can click Grant consent for your tenant. Now it might take up to 60 minutes for the changes to happen. Luckily we don´t have to sit around doing nothing as we still have to build our flow. (But you might as well get a cup of coffee as we already finished most of the work already and in addition I would always recommend drinking coffee :-))

3. Build the Flow in PowerAutomate

  1. Choose your PowerAutomate App in the O365 Portal or go to
  2. Create a new Flow from blank (skip all the settings or already type in a Name for your Flow)
  3. Search for Schedule as connector and choose Recurrence as a trigger and pick your favourite time.

  4. Add a new action and add the action Get Items ("Elemente abrufen") for the SharePoint Connector. For this purpose, I built up a simple example list that contains the requestor ("Urlauber") start and end date, which can be created/updated manually in our example (in our solution, this is done via Powerapps and PowerAutomate). The SharePoint List looks like this:

    Note: be sure to set the Title Field to not required or add some text and set at least one entry of the start date to today´s date (we´ll need that to test the Flow later on.)

    • Site Address: choose the site address where your list is located. It should be already listed. (if not, you can choose custom value and type in the URL.)
    • List Name: Pick your list name from the dropdown
    • Filter Query: type in the query: {SharepointColumnNameforStartdate} eq ' {expression '
    • The Expression: Click into the filter query field. On the right hand, click expression. Type in "utcNow('yyyy-MM-dd')"and click update.

  5. Add a HTTP Request action. The action should be automatically wrapped into an apply to each action without further action.

    • Method: Patch
    • URI: Content/mailboxSettings. for the dynamic Content use the  SharePoint Column with the Mail adress of the Person who entered the holiday from the previous Get Items Action. (You should of course inform them before you test it, otherwise you might be in big trouble :) 
    • HeadersContent-Type    /   application/json
    • Body: you can use this example:

        "automaticRepliesSetting": {
          "status": "Scheduled",
          "scheduledStartDateTime": {
            "dateTime": "2019-11-22T18:00:00.0000000",
            "timeZone": "UTC"
          "scheduledEndDateTime": {
            "dateTime": "2019-11-28T18:00:00.0000000",
            "timeZone": "UTC"
          "internalReplyMessage": "<html>\\\\\\\\\\\\\\\\n<body>\\\\\\\\\\\\\\\\n<p>I'm out of office from 
      Dynamic Content for Startdate from Get Items Action to Dynamic Content for Startdate from Get Items Action 
          "externalReplyMessage": "<html>\\\\\\\\\\\\\\\\n<body>\\\\\\\\\\\\\\\\n<p>I'm at the Contoso worldwide reunion and will respond to your message as soon as I return.<br>\\\\\\\\\\\\\\\\n</p></body>\\\\\\\\\\\\\\\\n</html>\\\\\\\\\\\\\\\\n"

  6. Now we finally can use our OAuth Token from the app registration. Click on Show advanced options in the HTTP Action. To fill in the tenant Client ID and the secret, you must open the overview of the App-Refgistration in Azure Active Directory again.

    • Authentication : Active Directory OAuth
    • Tenant: copy from App-Registration overview: Directory (tenant) ID
    • Audience:
    • Client ID : Copy from App-Reistration overview: Application (client) ID
    • Credential Type: Secret

    • Secret: Navigate to Certificates and secrets and click on New client Secret. Copy & Paste.

We are finished

Now you can test your Flow in the top right corner of the Flow editor and if a start date was set to today's date and the email address of the requestor was correctly entered, it changes the automatic reply in Outlook to the text that we pasted in JSon Style.