Microsoft Word · Arazzo Workflow

Microsoft Word Search and Download Document

Version 1.0.0

Search OneDrive for a Word document by name, confirm its metadata, and download its content.

1 workflow 1 source API 1 provider
View Spec View on GitHub DocumentsMicrosoft 365OfficeProductivityWord ProcessingArazzoWorkflows

Provider

microsoft-word

Workflows

search-and-download
Search for a document by name and download its content.
Searches the drive for items matching a query, resolves the first match's metadata, and downloads the file content stream.
3 steps inputs: searchText outputs: itemId, name, size
1
searchItems
searchDriveItems
Search the drive hierarchy for items matching the query string and capture the identifier of the first match.
2
getItem
getDriveItem
Read the full metadata of the matched item to confirm it is the intended document before downloading.
3
downloadContent
downloadContent
Download the primary file stream of the matched document. Graph returns 200 with the binary content of the file.

Source API Descriptions

Arazzo Workflow Specification

microsoft-word-search-and-download-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Microsoft Word Search and Download Document
  summary: Search OneDrive for a Word document by name, confirm its metadata, and download its content.
  description: >-
    Locating and retrieving a Word document from a user's OneDrive with Microsoft
    Graph. The workflow searches the drive hierarchy for items matching a query
    string, reads the full metadata of the first match to confirm name and size,
    and then downloads the primary file stream. Every step spells out its request
    inline so the flow can be read and executed without opening the underlying
    OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: graphApi
  url: ../openapi/microsoft-word-graph-api.yaml
  type: openapi
workflows:
- workflowId: search-and-download
  summary: Search for a document by name and download its content.
  description: >-
    Searches the drive for items matching a query, resolves the first match's
    metadata, and downloads the file content stream.
  inputs:
    type: object
    required:
    - searchText
    properties:
      searchText:
        type: string
        description: The search query text, e.g. a document filename.
  steps:
  - stepId: searchItems
    description: >-
      Search the drive hierarchy for items matching the query string and capture
      the identifier of the first match.
    operationId: searchDriveItems
    parameters:
    - name: search-text
      in: path
      value: $inputs.searchText
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      matchedItemId: $response.body#/value/0/id
      matchedName: $response.body#/value/0/name
  - stepId: getItem
    description: >-
      Read the full metadata of the matched item to confirm it is the intended
      document before downloading.
    operationId: getDriveItem
    parameters:
    - name: item-id
      in: path
      value: $steps.searchItems.outputs.matchedItemId
    - name: $select
      in: query
      value: id,name,size,file,webUrl
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      itemId: $response.body#/id
      name: $response.body#/name
      size: $response.body#/size
  - stepId: downloadContent
    description: >-
      Download the primary file stream of the matched document. Graph returns
      200 with the binary content of the file.
    operationId: downloadContent
    parameters:
    - name: item-id
      in: path
      value: $steps.getItem.outputs.itemId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $statusCode
  outputs:
    itemId: $steps.getItem.outputs.itemId
    name: $steps.getItem.outputs.name
    size: $steps.getItem.outputs.size