Microsoft Outlook · Arazzo Workflow

Microsoft Outlook Find and Forward

Version 1.0.0

Find a message by subject, read it, then forward it to a new recipient.

1 workflow 1 source API 1 provider
View Spec View on GitHub CalendarContactsEmailEnterpriseMicrosoftOffice 365ProductivityArazzoWorkflows

Provider

microsoft-outlook

Workflows

find-and-forward
Locate a message by subject, read it, and forward it onward.
Finds the first message matching a subject filter, reads it in full, and forwards it to the supplied recipient with a comment.
3 steps inputs: comment, forwardToAddress, subjectFilter outputs: forwardedMessageId, subject
1
findMessage
listMessages
Search the mailbox for the first message whose subject equals the supplied filter value.
2
readMessage
getMessage
Read the full properties of the matched message to confirm its subject and sender before forwarding.
3
forward
forwardMessage
Forward the message to the supplied recipient with the comment. Graph returns 202 Accepted and saves the forwarded copy to Sent Items.

Source API Descriptions

Arazzo Workflow Specification

microsoft-outlook-find-and-forward-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Microsoft Outlook Find and Forward
  summary: Find a message by subject, read it, then forward it to a new recipient.
  description: >-
    A delegate-this-email pattern. The workflow searches the mailbox for the
    first message matching a subject filter, reads its full content to confirm
    it is the right message, and forwards it to a supplied recipient with an
    optional comment. The matched message id flows through every step so the
    flow runs without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: outlookMailApi
  url: ../openapi/microsoft-graph-mail-api-openapi.yml
  type: openapi
workflows:
- workflowId: find-and-forward
  summary: Locate a message by subject, read it, and forward it onward.
  description: >-
    Finds the first message matching a subject filter, reads it in full, and
    forwards it to the supplied recipient with a comment.
  inputs:
    type: object
    required:
    - subjectFilter
    - forwardToAddress
    properties:
      subjectFilter:
        type: string
        description: The exact subject value to match when finding the message.
      forwardToAddress:
        type: string
        description: The email address to forward the message to.
      comment:
        type: string
        description: Optional comment to include when forwarding.
        default: ''
  steps:
  - stepId: findMessage
    description: >-
      Search the mailbox for the first message whose subject equals the
      supplied filter value.
    operationId: listMessages
    parameters:
    - name: $filter
      in: query
      value: "subject eq '$inputs.subjectFilter'"
    - name: $top
      in: query
      value: 1
    - name: $select
      in: query
      value: id,subject,from
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      matchedMessageId: $response.body#/value/0/id
    onSuccess:
    - name: messageFound
      type: goto
      stepId: readMessage
      criteria:
      - context: $response.body
        condition: $.value.length > 0
        type: jsonpath
    - name: noMatch
      type: end
      criteria:
      - context: $response.body
        condition: $.value.length == 0
        type: jsonpath
  - stepId: readMessage
    description: >-
      Read the full properties of the matched message to confirm its subject
      and sender before forwarding.
    operationId: getMessage
    parameters:
    - name: message-id
      in: path
      value: $steps.findMessage.outputs.matchedMessageId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      subject: $response.body#/subject
      fromAddress: $response.body#/from/emailAddress/address
  - stepId: forward
    description: >-
      Forward the message to the supplied recipient with the comment. Graph
      returns 202 Accepted and saves the forwarded copy to Sent Items.
    operationId: forwardMessage
    parameters:
    - name: message-id
      in: path
      value: $steps.findMessage.outputs.matchedMessageId
    requestBody:
      contentType: application/json
      payload:
        comment: $inputs.comment
        toRecipients:
        - emailAddress:
            address: $inputs.forwardToAddress
    successCriteria:
    - condition: $statusCode == 202
    outputs:
      forwardStatus: $statusCode
  outputs:
    forwardedMessageId: $steps.findMessage.outputs.matchedMessageId
    subject: $steps.readMessage.outputs.subject