Skip to main content

Copy object

Copies file or directory

Function CopyObject(Val Token, Val Identifier, Val NewName = "", Val NewParent = "") Export

ParameterCLI optionTypeRequiredDescription
Token--tokenStringToken
Identifier--objectStringObject identifier
NewName--titleStringNew object name
NewParent--catalogStringNew parent directory

Returns: Map Of KeyAndValue - serialized JSON response from Google


1C:Enterprise/OneScript code example
    Token      = "ya29.a0ARW5m7702-Ib_bOq69krqD5iUx89SC2lxGPxRJoBjqvSBqE7uKghOyAjwrL7ebNf6xqPzwD4wQfZlFvBrb7QsWlw5PGW_SvkFr57Y8Js...";
Identifier = "1Mjgg8XiYqU2gw4yjMU9d4RHfHsNENWDs";
NewName = "CopiedFile.jpeg";
NewParent = "root";

Result = OPI_GoogleDrive.CopyObject(Token, Identifier, NewName, NewParent);
    oint gdrive CopyObject \
--token "***" \
--object "1W_FHojYzsBLfmmILZZ8yL57pF4DJ4VVz" \
--title "CopiedFile.jpeg" \
--catalog "root"
Result
{
"kind": "drive#file",
"id": "19rwnmeC5Vro9P_yBfeKsPLeuSOU9Y9oC",
"name": "CopiedFile.jpeg",
"mimeType": "image/jpeg"
}