CopyResource Method
Copies the currently selected resource.
Syntax
public void copyResource(String parentId, String newName);
Remarks
This method copies the resource currently selected by RemoteId or RemotePath. The following outcomes are possible depending on which of NewName and ParentId are provided:
Parameters Provided | Effect |
Only NewName | Copies the resource in place with the new name. |
Only ParentId | Copies the resource to the given parent with the same name. |
NewName and ParentId | Copies the resource to the given parent with the new name. |
None | Exception; at least one parameter must be provided. |
ParentId, if provided, must either be the Id of a folder resource that already exists in the drive currently selected by Drive, or root (an alias for the root of the drive).
Monitoring Copy Operations
All copy operations are asynchronous. After calling CopyResource, the CopyStatusURL configuration setting will be populated with a copy operation monitor URL.
The PollCopyStatus method can be used to retrieve the latest status of the copy operation specified by the CopyStatusURL configuration setting. Calling PollCopyStatus will populate the CopyPercentDone, CopyStatus, and (if applicable) CopiedResourceId properties.