The object tagging feature uses a key-value pair to tag an object. This topic describes how to query the tags added to an object:

The following code provides an example on how to query the tags added to an object:

using Aliyun.OSS;
var endpoint = "<yourEndpoint>";
var accessKeyId = "<yourAccessKeyId>";
var accessKeySecret = "<yourAccessKeySecret>";
var bucketName = "<yourBucketName>";
var objectName = "<yourObjectName>";
// Create an OSSClient instance.
var client = new OssClient(endpoint, accessKeyId, accessKeySecret);
try
{
    // Query the tags added to the object.
    var result = client.GetObjectTagging(bucketName,objectName);
    Console.WriteLine("get objects tagging succeeded");
    foreach (var tag in result.Tags)
    {
        Console.WriteLine("key:{0}, value:{1}", tag.Key, tag.Value);
    }
}
catch (Exception ex)
{
    Console.WriteLine("get objects tagging failed. {0}", ex.Message);
}

For more information about how to query the tags added to an object, see GetObjectTagging. For more information about the object tagging feature, see Configure object tagging.