1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-27 22:18:36 +02:00
Files
OpenIntegrations/docs/en/md/GoogleDrive/File-and-directory-management/Update-file.mdx

77 lines
2.2 KiB
Plaintext
Raw Normal View History

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-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2025-10-20 19:41:52 +03:00
Token = FunctionParameters["Google_Token"];
2024-10-15 10:16:04 +03:00
NewName = "UpdatedFile.jpg";
2025-10-20 19:41:52 +03:00
Identifier = FunctionParameters["GD_File"];
File = FunctionParameters["Picture2"]; // 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-10-15 14:32:00 +03:00
--object "1SdgrlViZM0g-ROR19eyFdWaooX8pZzZQ" \
2025-07-05 18:56:59 +03:00
--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-10-15 14:32:00 +03:00
--object "1SdgrlViZM0g-ROR19eyFdWaooX8pZzZQ" ^
2025-07-05 18:56:59 +03:00
--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",
2025-10-15 14:32:00 +03:00
"id": "1SdgrlViZM0g-ROR19eyFdWaooX8pZzZQ",
2024-10-15 10:16:04 +03:00
"name": "UpdatedFile.jpg",
"mimeType": "image/jpeg"
}
```