# File management

### Copy file

Copies a file from a Document Library to another (or the same) Document Library at the same SharePoint site.

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

| Parameter                         | Description                                                                                                                                         |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Source Document Library Name      | Name of source Document Library in SharePoint to copy file from                                                                                     |
| Source filename                   | Remote filename in Document Library, including any extensions or folders if applicable. E.g. "file.txt" or "subfolder1/subfolder2/file.txt" to move |
| Destination Document Library Name | Name of target Document Library in SharePoint to copy file to                                                                                       |
| Destination filename              | Name of file in destination Document Library                                                                                                        |
| Overwrite                         | Specifies whether to overwrite destination file if it already exists                                                                                |

#### 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. |

### Delete file <a href="#delete-file" id="delete-file"></a>

Deletes a file in the Document Library. If the file does not exist, the operation is considered succesful.

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

| Parameter             | Description                                                                                                                                         |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Document Library Name | Name of Document Library in SharePoint (not id)                                                                                                     |
| Filename              | Remote filename in Document Library, including any extensions or folders if applicable. E.g. "file.txt" or "subfolder1/subfolder2/file.txt" to move |

#### 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. |

### Get file information <a href="#get-file-information" id="get-file-information"></a>

Gets information about a file provided as a releative url, example: '/subsite1/Shared Documents/file.doc'

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

| Parameter             | Description                                                                                                                                 |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| Document Library Name | Name of Document Library in SharePoint (not id)                                                                                             |
| Filename              | Remote filename in Document Library, including any extensions or folders if applicable. E.g. "file.txt" or "subfolder1/subfolder2/file.txt" |

#### 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      | Record variable containing the results of operation                    |

**Structure of Results Results**

&#x20;Author

* &#x20;Id
* &#x20;LoginName
* &#x20;Email
* &#x20;Title
* &#x20;IsSiteAdmin

&#x20;CheckedOutByUser

* &#x20;Id
* &#x20;LoginName
* &#x20;Email
* &#x20;Title
* &#x20;IsSiteAdmin

&#x20;LockedByUser

* &#x20;Id
* &#x20;LoginName
* &#x20;Email
* &#x20;Title
* &#x20;IsSiteAdmin

&#x20;ModifiedBy

* &#x20;Id
* &#x20;LoginName
* &#x20;Email
* &#x20;Title
* &#x20;IsSiteAdmin

&#x20;CheckInComment

&#x20;CheckOutType

&#x20;ContentTag

&#x20;CustomizedPageStatus

&#x20;ETag

&#x20;Exists

&#x20;Length

&#x20;Level

&#x20;MajorVersion

&#x20;MinorVersion

&#x20;Name

&#x20;ServerRelativeUrl

&#x20;TimeCreated

&#x20;TimeLastModified

&#x20;Title

&#x20;UIVersion

&#x20;UIVersionLabel

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

| Error code | Description        |
| ---------- | ------------------ |
| 1000       | Unspecified error. |

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

Lists all files at the root of a Document Library

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

| Parameter             | Description                                                                          |
| --------------------- | ------------------------------------------------------------------------------------ |
| Document Library Name | Name of Document Library in SharePoint (not id)                                      |
| Populate user members | Specifies whether to populate members that relates to SharePoint users, e.g. Author. |

#### 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;Author

* &#x20;Id
* &#x20;LoginName
* &#x20;Email
* &#x20;Title
* &#x20;IsSiteAdmin

&#x20;CheckedOutByUser

* &#x20;Id
* &#x20;LoginName
* &#x20;Email
* &#x20;Title
* &#x20;IsSiteAdmin

&#x20;LockedByUser

* &#x20;Id
* &#x20;LoginName
* &#x20;Email
* &#x20;Title
* &#x20;IsSiteAdmin

&#x20;ModifiedBy

* &#x20;Id
* &#x20;LoginName
* &#x20;Email
* &#x20;Title
* &#x20;IsSiteAdmin

&#x20;CheckInComment

&#x20;CheckOutType

&#x20;ContentTag

&#x20;CustomizedPageStatus

&#x20;ETag

&#x20;Exists

&#x20;Length

&#x20;Level

&#x20;MajorVersion

&#x20;MinorVersion

&#x20;Name

&#x20;ServerRelativeUrl

&#x20;TimeCreated

&#x20;TimeLastModified

&#x20;Title

&#x20;UIVersion

&#x20;UIVersionLabel

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

| Error code | Description        |
| ---------- | ------------------ |
| 1000       | Unspecified error. |

### Move file <a href="#move-file" id="move-file"></a>

Moves a file from a Document Library to another (or the same) Document Library at the same SharePoint site.

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

| Parameter                         | Description                                                                                                                                         |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Source Document Library Name      | Name of source Document Library in SharePoint to move file from                                                                                     |
| Source filename                   | Remote filename in Document Library, including any extensions or folders if applicable. E.g. "file.txt" or "subfolder1/subfolder2/file.txt" to move |
| Destination Document Library Name | Name of target Document Library in SharePoint to move file to                                                                                       |
| Destination filename              | Name of file in destination Document Library                                                                                                        |
| Move operations                   | Specifies move options.                                                                                                                             |

#### 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. |

### Update file property <a href="#update-file-property" id="update-file-property"></a>

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

| Parameter           | Description                                                        |
| ------------------- | ------------------------------------------------------------------ |
| Server relative url | An url relative to server, e.g. "/subsite/doclib/folder/file.txt". |
| Field name          | Name of field or column                                            |
| New value           | The new value to set on field                                      |

#### 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. |
