1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-01 22:29:52 +02:00
Files
OpenIntegrations/docs/en/md/Google_Drive/File-and-directory-management/Update-file.mdx
Vitaly the Alpaca (bot) d71db5d6e3 Main build (Jenkins)
2025-05-05 10:07:34 +03:00

78 lines
2.4 KiB
Plaintext
Vendored

---
sidebar_position: 8
description: "Update file" and other functions to work with Google Drive in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Google Drive]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Update file
Updates file binary data
`Function UpdateFile(Val Token, Val Identifier, Val File, Val NewName = "") Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Token |
| Identifier | --object | String | ✔ | Identifier of the object to update |
| File | --file | BinaryData,String | ✔ | File source for update |
| NewName | --title | String | ✖ | New file name (if necessary) |
Returns: Map Of KeyAndValue - serialized JSON response from Google
<br/>
:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Token = "ya29.a0AZYkNZiCaf3vW8I05cl_i6pLKCRWSjff1YhC7Yi0SgLO50zysjwrX_9QPi1WejmqgGdFjcbaOJKsPO3tvT7gB712mg1gxgxiL1pCUVthx...";
NewName = "UpdatedFile.jpg";
Identifier = "1CK_FNwlq0eNfmse2YyeXaNStG80Lu2wI";
File = "https://api.athenaeum.digital/test_data/picture2.jpg"; // URL, Binary Data or File path
Result = OPI_GoogleDrive.UpdateFile(Token, Identifier, File, NewName);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint gdrive UpdateFile \
--token "***" \
--object "17mRmuTKqO23zMKyw483Awr4zhFrcGBXR" \
--file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg" \
--title "UpdatedFile.jpg"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint gdrive UpdateFile ^
--token "***" ^
--object "17mRmuTKqO23zMKyw483Awr4zhFrcGBXR" ^
--file "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg" ^
--title "UpdatedFile.jpg"
```
</TabItem>
</Tabs>
```json title="Result"
{
"kind": "drive#file",
"id": "1slRtvK9Yap08a-wh_iE5go6dkCMwZrYH",
"name": "UpdatedFile.jpg",
"mimeType": "image/jpeg"
}
```