Obtaining 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.GetObject to pass the version ID (VersionId) to obtain 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");
// Obtain versioning objects.
try
{
    GetObjectRequest getObjectRequest = new GetObjectRequest()
    {
        BucketName = "bucketname",
        ObjectKey = "objectname",
        VersionId = "versionId",
    };
    using (GetObjectResponse response = client.GetObject(getObjectRequest))
    {
        Console.WriteLine("Get object response: {0}", response.StatusCode);
        //Save the file locally.
        if (!File.Exists("savePath"))
        {
            response.WriteResponseStreamToFile("savePath");
        }
    }
}
catch (ObsException ex)
{
    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
}

If the version ID is null, the object of the latest version will be downloaded, by default.