Microsoft Outlook · Arazzo Workflow

Microsoft Outlook File Message into New Folder

Version 1.0.0

Create a mail folder, find a matching message, and move it into the folder.

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

Provider

microsoft-outlook

Workflows

file-message-into-new-folder
Create a folder, locate a message, and move the message into it.
Creates a new mail folder, finds the first message whose subject matches the supplied filter, and moves that message into the new folder.
3 steps inputs: folderName, subjectFilter outputs: folderId, movedMessageId
1
createFolder
createMailFolder
Create a new top-level mail folder in the root of the mailbox and capture its folder id for use as a move destination.
2
findMessage
listMessages
Search the mailbox for the first message whose subject equals the supplied filter value.
3
moveMessage
moveMessage
Move the matched message into the new folder by passing the folder id as the destination. Graph returns 201 with the moved message copy.

Source API Descriptions

Arazzo Workflow Specification

microsoft-outlook-file-message-into-new-folder-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Microsoft Outlook File Message into New Folder
  summary: Create a mail folder, find a matching message, and move it into the folder.
  description: >-
    An organize-my-inbox pattern. The workflow creates a new top-level mail
    folder, searches the mailbox for the first message matching a subject
    filter, and moves that message into the freshly created folder using the
    folder id as the destination. The folder id and message id chain across the
    steps 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: file-message-into-new-folder
  summary: Create a folder, locate a message, and move the message into it.
  description: >-
    Creates a new mail folder, finds the first message whose subject matches
    the supplied filter, and moves that message into the new folder.
  inputs:
    type: object
    required:
    - folderName
    - subjectFilter
    properties:
      folderName:
        type: string
        description: The display name of the new mail folder to create.
      subjectFilter:
        type: string
        description: The exact subject value to match when finding the message.
  steps:
  - stepId: createFolder
    description: >-
      Create a new top-level mail folder in the root of the mailbox and
      capture its folder id for use as a move destination.
    operationId: createMailFolder
    requestBody:
      contentType: application/json
      payload:
        displayName: $inputs.folderName
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      folderId: $response.body#/id
  - 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,parentFolderId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      matchedMessageId: $response.body#/value/0/id
    onSuccess:
    - name: messageFound
      type: goto
      stepId: moveMessage
      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: moveMessage
    description: >-
      Move the matched message into the new folder by passing the folder id
      as the destination. Graph returns 201 with the moved message copy.
    operationId: moveMessage
    parameters:
    - name: message-id
      in: path
      value: $steps.findMessage.outputs.matchedMessageId
    requestBody:
      contentType: application/json
      payload:
        destinationId: $steps.createFolder.outputs.folderId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      movedMessageId: $response.body#/id
      newParentFolderId: $response.body#/parentFolderId
  outputs:
    folderId: $steps.createFolder.outputs.folderId
    movedMessageId: $steps.moveMessage.outputs.movedMessageId