2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 8
2025-05-05 11:15:20 +03:00
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
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Google Drive]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Update file
Updates file binary data
`Function UpdateFile(Val Token, Val Identifier, Val File, Val NewName = "") Export`
2024-10-15 15:15:47 +03:00
| 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) |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Google
<br/>
2024-10-15 13:51:58 +03:00
:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
2024-10-15 10:16:04 +03:00
2024-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2025-06-29 14:35:33 +03:00
Token = "ya29.a0AS3H6NxB7WbMUyy-yHnfRFo_Sv93kSJ3qRUtm2Iz4ECHVXn6mxSdB_skIS4UjiiI5q31PT-HL6O-1hC-8T_AgNAMsGHBh28RbM4ISAvKK...";
2024-10-15 10:16:04 +03:00
NewName = "UpdatedFile.jpg";
2025-06-29 14:35:33 +03:00
Identifier = "1zWya_9PDkEpFOvKMZiLbTntP3VwfeXH8";
File = "https://hut.openintegrations.dev/test_data/picture2.jpg"; // URL, Binary Data or File path
2024-10-15 10:16:04 +03:00
Result = OPI_GoogleDrive.UpdateFile(Token, Identifier, File, NewName);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint gdrive UpdateFile \
2024-10-22 08:59:24 +03:00
--token "***" \
2025-07-05 18:56:59 +03:00
--object "1CNGa2eXRhyCtTAMksyW7PVhkskQh7R3D" \
--file "https://hut.openintegrations.dev/test_data/picture2.jpg" \
2024-10-22 08:59:24 +03:00
--title "UpdatedFile.jpg"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint gdrive UpdateFile ^
2024-10-22 08:59:24 +03:00
--token "***" ^
2025-07-05 18:56:59 +03:00
--object "1CNGa2eXRhyCtTAMksyW7PVhkskQh7R3D" ^
--file "https://hut.openintegrations.dev/test_data/picture2.jpg" ^
2024-10-22 08:59:24 +03:00
--title "UpdatedFile.jpg"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"kind": "drive#file",
"id": "1slRtvK9Yap08a-wh_iE5go6dkCMwZrYH",
"name": "UpdatedFile.jpg",
"mimeType": "image/jpeg"
}
```