Dialogue Cloud

Example configuration Microsoft Power Automate to categorize email subject based on Microsoft Dynamics 365


  • Azure Graph API, with the following permission:
    • Type = Application
    • Permissions = Mail.ReadWrite


In this guide you will create a Microsoft Power Automate solution, in which you create a Flow that will set a category on an email based on the contact information in Dynamics 365 (in this example Account Relation Status), Learn More

Step 1: Create Outlook rule

The Anywhere365 automatically processes a new email as soon as it enters the Inbox. Because of this reason you first need to create an Outlook rule to move the email in a pre-process folder. Below on how to move all email to a folder. Of course you can create your own rules:

  1. Open Outlook (web) client.
  2. Open "Rules, Create New".

  1. Click "Advanced Options...".
  2. Click "Next".
  3. Check "Move it to specified folder".
  4. Select the folder where you want to move it to, for example "Pre-Process".
  5. Click "Finish".


Step 2: Create a Microsoft Power Automate Flow

  1. From your Office Portal, go to your Power Automate App.

  2. Click "My Flow".

  3. Click "New" and "Create from Blank".

  4. Select connector "Office 365 Outlook, When a new email arrives".

    1. Select the folder you used for the pre-process.

  5. Add the step "Dynamics 365, List records":

    1. Organization Name = Connect to your organization tenant

    2. Entity Name = Contacts

    3. Filter Query = emailaddress1 eq '@{triggerBody()?['from']}'

  6. Add the step "Initialize variable":

    1. Name = Company

    2. Type = String

    3. Value:

  7. Add the step "Dynamics 365, Get record".

    1. Organization Name = Connect to your organization tenant

    2. Entity Name = Accounts

    3. Item identifier:

  8. Add the step "Initialize variable":

    1. Set "TopScoring" as name.

    2. Set "Sting" as Type.

    3. Set the following Value:

  9. Add the step "HTTP".

    1. Set "Patch" as method.

    2. Add the following uri:

      https://graph.microsoft.com/v1.0/users/[user id]/messages/[Message id]
    3. Add the following body:

    4. Change Authentication to "Active Directory OAuth".

    5. Tenant = Directory (tenant) ID, found in the App Overview

    6. Audience = https://graph.microsoft.com

    7. Client ID = Application (client) ID, found in the App Overview

    8. Credential Type = "Secret"

    9. Secret = Secret, can be created in Azure under "Certificates & Secrets"

  10. Create a new step "Data Operations, Parse JSON".

  11. Create a new step "Office 365 Outlook, Move Email":

    1. Set "Message id" as Message Id.

    2. Set "Inbox" as Folder.