Copying a Versioning Object
If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference
You can call ObsClient.CopyObject to pass the version ID (SourceVersionId) to copy a versioning object. Sample code is as follows:
// Create an instance of ObsClient.
ObsClient client = new ObsClient("*** Provide your Access Key ***", "*** Provide your Secret Key ***", "https://your-endpoint");
// Copy a versioning object.
try
{
CopyObjectRequest request = new CopyObjectRequest();
request.SourceBucketName = "sourcebucketname";
request.SourceObjectKey = "sourceobjectname";
request.BucketName = "destbucketname";
request.ObjectKey = "destobjectName";
request.SourceVersionId = "sourceversionId";
CopyObjectResponse response = client.CopyObject(request);
Console.WriteLine("copy object response: {0}", response.StatusCode);
}
catch (ObsException ex)
{
Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
} Last Article: Obtaining a Versioning Object
Next Article: Restoring an Archive Object with a Specified Version ID
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.