Object tagging uses a key-value pair to identify objects. This topic describes how to delete the tags of an object.

Sample code

The following code provides an example on how to delete the tags of an object:

using Aliyun.OSS;
// Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. 
var endpoint = "yourEndpoint";
// The AccessKey pair of an Alibaba Cloud account has permissions on all API operations. Using these credentials to perform operations in OSS is a high-risk operation. We recommend that you use a RAM user to call API operations or perform routine O&M. To create a RAM user, log on to the RAM console. 
var accessKeyId = "yourAccessKeyId";
var accessKeySecret = "yourAccessKeySecret";
// Specify the name of the bucket. Example: examplebucket. 
var bucketName = "examplebucket";
// Specify the full path of the object. The full path of the object cannot contain the bucket name. Example: exampledir/exampleobject.txt. 
var objectName = "exampledir/exampleobject.txt";
// Create an OSSClient instance. 
var client = new OssClient(endpoint, accessKeyId, accessKeySecret);
try
{
    // Delete the tags of the object. 
    var result = client.DeleteObjectTagging(bucketName,objectName);
    Console.WriteLine("delete objects tagging succeeded");
}
catch (Exception ex)
{
    Console.WriteLine("delete objects failed. {0}", ex.Message);
}

References

For more information about the API operation that you can call to delete the tags of an object, see DeleteObjectTagging.