> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# Download File

- Component: `appmixer.microsoft.sharepoint.DownloadFile`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.microsoft.sharepoint 3.1.0](https://connectors.appmixer.com/connector/appmixer.microsoft.sharepoint/3.1.0.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.microsoft.sharepoint/3.1.0/component/appmixer.microsoft.sharepoint.DownloadFile>

Retrieve a file content from Microsoft SharePoint.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Site ID (`siteId`) | text | Provide a site ID. |
| Drive ID (`driveId`) | text | ID of the drive where the file is located. |
| Item ID (`itemId`) | text | ID assigned to a file in SharePoint. |
| Item Path (`itemPath`) | text | Path of a file in SharePoint **(Ignored if 'Item ID' is set)**. Example: `path/to/file/file.pdf`. |
| Custom File Name (`customFileName`) | text | Provide a custom name for the downloaded file, including its extension (e.g., file.png). |
| Output File Data (`outputFileData`) | toggle | By default, DownloadFile does not return the actual file content, allowing very large files to be downloaded and manipulated without working with the data directly. For convenience, if your files are smaller than 10 MB and you want to work with the file data directly, you can set this option. (File data can be read using the Files.LoadFile utility when necessary). |
| Output File Data Encoding (`outputFileDataEncoding`) | select | If you want to download the file content, you can specify the encoding of the file data. The default is 'utf8' (plain text). If you are downloading a binary file (e.g. an image), you can select 'base64' encoding. |
| Convert Format (`format`) | select | Some files can be converted into selected file format. PDF and TXT convertion follows the same file restriction. |

## Output ports

### Port `out`

| Field | Type | Description |
| --- | --- | --- |
| Length (`length`) | - | - |
| Chunk Size (`chunkSize`) | - | - |
| Upload Date (`uploadDate`) | - | - |
| Filename (`filename`) | - | - |
| MD5 (`md5`) | - | - |
| Metadata (`metadata`) | object | - |
| Content Type (`contentType`) | - | - |
| File ID (`fileId`) | - | - |
| File Data (`content`) | string | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.microsoft.sharepoint.DownloadFile",
  "label": "Download File",
  "author": "Appmixer <info@apppmixer.com>",
  "description": "Retrieve a file content from Microsoft SharePoint.",
  "private": false,
  "auth": {
    "service": "appmixer:microsoft",
    "scope": [
      "Files.Read.All",
      "Sites.Read.All"
    ]
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "siteId": {
            "type": "string"
          },
          "driveId": {
            "type": "string"
          },
          "itemId": {
            "type": "string"
          },
          "itemPath": {
            "type": "string"
          },
          "customFileName": {
            "type": "string"
          },
          "outputFileData": {
            "type": "boolean"
          },
          "outputFileDataEncoding": {
            "type": "string"
          },
          "format": {
            "type": "string"
          }
        },
        "required": [
          "driveId"
        ],
        "oneOf": [
          {
            "required": [
              "itemPath"
            ]
          },
          {
            "required": [
              "itemId"
            ]
          }
        ]
      },
      "inspector": {
        "inputs": {
          "siteId": {
            "type": "text",
            "label": " Site ID",
            "index": 1,
            "tooltip": "Provide a site ID.",
            "source": {
              "url": "/component/appmixer/microsoft/sharepoint/ListSites?outPort=out",
              "data": {
                "transform": "./ListSites#sitesToSelectArray"
              }
            }
          },
          "driveId": {
            "type": "text",
            "index": 2,
            "label": "Drive ID",
            "tooltip": "ID of the drive where the file is located.",
            "source": {
              "url": "/component/appmixer/microsoft/sharepoint/ListDrives?outPort=out",
              "data": {
                "messages": {
                  "in/siteId": "inputs/in/siteId"
                },
                "transform": "./ListDrives#drivesToSelectArray"
              }
            }
          },
          "itemId": {
            "type": "text",
            "index": 3,
            "label": "Item ID",
            "tooltip": "ID assigned to a file in SharePoint."
          },
          "itemPath": {
            "type": "text",
            "index": 4,
            "label": "Item Path",
            "tooltip": "Path of a file in SharePoint <b>(Ignored if 'Item ID' is set)</b>. Example: <code>path/to/file/file.pdf</code>."
          },
          "customFileName": {
            "type": "text",
            "index": 5,
            "label": "Custom File Name",
            "tooltip": "Provide a custom name for the downloaded file, including its extension (e.g., file.png)."
          },
          "outputFileData": {
            "type": "toggle",
            "index": 6,
            "defaultValue": false,
            "label": "Output File Data",
            "tooltip": "By default, DownloadFile does not return the actual file content, allowing very large files to be downloaded and manipulated without working with the data directly. For convenience, if your files are smaller than 10 MB and you want to work with the file data directly, you can set this option. (File data can be read using the Files.LoadFile utility when necessary)."
          },
          "outputFileDataEncoding": {
            "type": "select",
            "index": 8,
            "label": "Output File Data Encoding",
            "tooltip": "If you want to download the file content, you can specify the encoding of the file data. The default is 'utf8' (plain text). If you are downloading a binary file (e.g. an image), you can select 'base64' encoding.",
            "defaultValue": "utf8",
            "options": [
              {
                "label": "UTF-8",
                "value": "utf8"
              },
              {
                "label": "Base64",
                "value": "base64"
              },
              {
                "label": "Base64url",
                "value": "base64url"
              },
              {
                "label": "Hex",
                "value": "hex"
              },
              {
                "label": "ASCII",
                "value": "ascii"
              }
            ]
          },
          "format": {
            "index": 7,
            "type": "select",
            "label": "Convert Format",
            "tooltip": "Some files can be converted into selected file format. PDF and TXT convertion follows the same file restriction.",
            "options": [
              {
                "clearItem": true,
                "value": "<empty>"
              },
              {
                "label": "PDF",
                "value": "pdf"
              },
              {
                "label": "HTML",
                "value": "html"
              },
              {
                "label": "Text File (.txt)",
                "value": "txt"
              }
            ]
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "options": [
        {
          "label": "Length",
          "value": "length",
          "schema": {
            "example": 524288
          }
        },
        {
          "label": "Chunk Size",
          "value": "chunkSize",
          "schema": {
            "example": 261120
          }
        },
        {
          "label": "Upload Date",
          "value": "uploadDate",
          "schema": {
            "example": "2026-01-15T10:30:00Z"
          }
        },
        {
          "label": "Filename",
          "value": "filename",
          "schema": {
            "example": "quarterly-report.xlsx"
          }
        },
        {
          "label": "MD5",
          "value": "md5",
          "schema": {
            "example": "d41d8cd98f00b204e9800998ecf8427e"
          }
        },
        {
          "label": "Metadata",
          "value": "metadata",
          "schema": {
            "type": "object",
            "properties": {
              "originFlowId": {
                "label": "Origin FlowId",
                "value": "originFlowId"
              },
              "adapterName": {
                "label": "Adapter Name",
                "value": "adapterName"
              },
              "userId": {
                "label": "User Id",
                "value": "userId"
              },
              "fileId": {
                "label": "File Id",
                "value": "fileId"
              }
            },
            "example": {}
          }
        },
        {
          "label": "Content Type",
          "value": "contentType",
          "schema": {
            "example": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
          }
        },
        {
          "label": "File ID",
          "value": "fileId",
          "schema": {
            "example": "file-abc123xyz"
          }
        },
        {
          "label": "File Data",
          "value": "content",
          "schema": {
            "type": "string",
            "example": "Q3 revenue grew 12 % quarter over quarter."
          }
        }
      ]
    }
  ],
  "icon": "(data URI omitted)"
}
```
