Obtaining Object Properties

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.GetObjectMetadata to obtain object properties, including the last modification time, version ID, and customized metadata. 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 the bucket metadata.
try
{
    GetObjectMetadataRequest request = new GetObjectMetadataRequest();
    request.BucketName = "bucketname";
    request.ObjectKey = "objectname";
    GetObjectMetadataResponse response = client.GetObjectMetadata(request);
    Console.WriteLine("Get object metadata response: {0}", response.StatusCode);
    Console.WriteLine("Object etag {0} :  ", response.ETag);
    Console.WriteLine("Object versionId {0} :  ", response.VersionId);
    Console.WriteLine("Object contentLength {0} :  ", response.ContentLength);
}
catch (ObsException ex)
{
   Console.WriteLine("Message: {0}", ex.Message);
}