# Attachments

### Add attached file (from bytes)

Upload a file as an attachment to task item.

#### Parameters <a href="#parameters" id="parameters"></a>

| Parameter            | Description                                    |
| -------------------- | ---------------------------------------------- |
| Custom List app name | Name of Custom List app in SharePoint (not id) |
| Item ID              | ID of item                                     |
| Remote filename      | Remote filename                                |
| Source bytes         | Table (consisting of bytes) to read from       |

#### Output <a href="#output" id="output"></a>

Record with information about whether operation failed or not.

| Member       | Description                                                            |
| ------------ | ---------------------------------------------------------------------- |
| HasFailed    | Whether operation has failed or not                                    |
| ErrorMessage | A description of the failure, if any                                   |
| ErrorCode    | An error code related to operation failure. Is 0 if no failure occured |

#### Errors <a href="#errors" id="errors"></a>

| Error code | Description                                  |
| ---------- | -------------------------------------------- |
| 1000       | Unspecified error.                           |
| 1000001    | User is not authorized to perform operation. |
| 1000004    | Item with given id does not exist.           |

### Add attached file (from file system) <a href="#add-attached-file-from-file-system" id="add-attached-file-from-file-system"></a>

Upload a file as an attachment to task item.

#### Parameters <a href="#parameters" id="parameters"></a>

| Parameter            | Description                                                                                                            |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Custom List app name | Name of Custom List app in SharePoint (not id)                                                                         |
| Item ID              | ID of item                                                                                                             |
| Remote filename      | Remote filename                                                                                                        |
| Local filename       | Full path to file to upload. Note that the user the application pool running Flow Server must have access to the file. |

#### Output <a href="#output" id="output"></a>

Record with information about whether operation failed or not.

| Member       | Description                                                            |
| ------------ | ---------------------------------------------------------------------- |
| HasFailed    | Whether operation has failed or not                                    |
| ErrorMessage | A description of the failure, if any                                   |
| ErrorCode    | An error code related to operation failure. Is 0 if no failure occured |

#### Errors <a href="#errors" id="errors"></a>

| Error code | Description                                  |
| ---------- | -------------------------------------------- |
| 1000       | Unspecified error.                           |
| 1000001    | User is not authorized to perform operation. |
| 1000004    | Item with given id does not exist.           |

### Add attached file (from stream) <a href="#add-attached-file-from-stream" id="add-attached-file-from-stream"></a>

Upload a file as an attachment to task item.

#### Parameters <a href="#parameters" id="parameters"></a>

| Parameter            | Description                                    |
| -------------------- | ---------------------------------------------- |
| Custom List app name | Name of Custom List app in SharePoint (not id) |
| Item ID              | ID of item                                     |
| Filename             | Remote filename                                |
| Source stream        | Simple variable containg a stream              |

#### Output <a href="#output" id="output"></a>

Record with information about whether operation failed or not.

| Member       | Description                                                            |
| ------------ | ---------------------------------------------------------------------- |
| HasFailed    | Whether operation has failed or not                                    |
| ErrorMessage | A description of the failure, if any                                   |
| ErrorCode    | An error code related to operation failure. Is 0 if no failure occured |

#### Errors <a href="#errors" id="errors"></a>

| Error code | Description                                  |
| ---------- | -------------------------------------------- |
| 1000       | Unspecified error.                           |
| 1000001    | User is not authorized to perform operation. |
| 1000004    | Item with given id does not exist.           |

### Delete all attached files <a href="#delete-all-attached-files" id="delete-all-attached-files"></a>

Delete all attachments on provided task item.

#### Parameters <a href="#parameters" id="parameters"></a>

| Parameter            | Description                                    |
| -------------------- | ---------------------------------------------- |
| Custom List app name | Name of Custom List app in SharePoint (not id) |
| Item ID              | ID of item                                     |
| Filename             | Remote filename                                |

#### Output <a href="#output" id="output"></a>

Record with information about whether operation failed or not.

| Member       | Description                                                            |
| ------------ | ---------------------------------------------------------------------- |
| HasFailed    | Whether operation has failed or not                                    |
| ErrorMessage | A description of the failure, if any                                   |
| ErrorCode    | An error code related to operation failure. Is 0 if no failure occured |

#### Errors <a href="#errors" id="errors"></a>

| Error code | Description                                  |
| ---------- | -------------------------------------------- |
| 1000       | Unspecified error.                           |
| 1000001    | User is not authorized to perform operation. |
| 1000004    | Item with given id does not exist.           |

### Delete all attached files <a href="#delete-all-attached-files" id="delete-all-attached-files"></a>

Delete all attachments on provided task item.

#### Parameters <a href="#parameters" id="parameters"></a>

| Parameter            | Description                                    |
| -------------------- | ---------------------------------------------- |
| Custom List app name | Name of Custom List app in SharePoint (not id) |
| Item ID              | ID of item                                     |
| Filename             | Remote filename                                |

#### Output <a href="#output" id="output"></a>

Record with information about whether operation failed or not.

| Member       | Description                                                            |
| ------------ | ---------------------------------------------------------------------- |
| HasFailed    | Whether operation has failed or not                                    |
| ErrorMessage | A description of the failure, if any                                   |
| ErrorCode    | An error code related to operation failure. Is 0 if no failure occured |

#### Errors <a href="#errors" id="errors"></a>

| Error code | Description                                  |
| ---------- | -------------------------------------------- |
| 1000       | Unspecified error.                           |
| 1000001    | User is not authorized to perform operation. |
| 1000004    | Item with given id does not exist.           |

### List attached files <a href="#list-attached-files" id="list-attached-files"></a>

Lists all files attached to specified item.

#### Parameters <a href="#parameters" id="parameters"></a>

| Parameter            | Description                                    |
| -------------------- | ---------------------------------------------- |
| Custom List app name | Name of Custom List app in SharePoint (not id) |
| Item ID              | ID of item                                     |

#### Output <a href="#output" id="output"></a>

Record with information about whether operation failed or not. If succesful, result of operation is stored in Results member

| Member       | Description                                                            |
| ------------ | ---------------------------------------------------------------------- |
| HasFailed    | Whether operation has failed or not                                    |
| ErrorMessage | A description of the failure, if any                                   |
| ErrorCode    | An error code related to operation failure. Is 0 if no failure occured |
| Results      | Table variable containing the results of operation                     |

Structure of Results Results

&#x20;Filename

&#x20;ServerRelativeUrl

#### Errors <a href="#errors" id="errors"></a>

| Error code | Description                                  |
| ---------- | -------------------------------------------- |
| 1000       | Unspecified error.                           |
| 1000001    | User is not authorized to perform operation. |
| 1000004    | Item with given id does not exist.           |
