Tüm Ürünler
Search
Belge Merkezi

Object Storage Service:Delete object tags (C# SDK V1)

Son Güncelleme:Oct 01, 2026

Nesne etiketleme, nesneleri anahtar-değer çiftleri kullanarak işaretlemenizi sağlar. Bu konuda nesne etiketlerinin nasıl silineceği anlatılmaktadır.

Notlar

  • Bu konuda Çin (Hangzhou) bölgesinin genel uç noktası kullanılmıştır. OSS ile aynı bölgedeki diğer Alibaba Cloud hizmetlerinden OSS'e erişmek istiyorsanız dahili uç nokta kullanın. OSS bölgeleri ve uç noktaları hakkında daha fazla bilgi için bkz. Bölgeler ve uç noktalar.

  • Bu konuda bir OSS uç noktası kullanılarak OSSClient örneğinin nasıl oluşturulacağı gösterilmektedir. Özel etki alanı kullanma veya Security Token Service (STS) kimlik bilgileriyle kimlik doğrulama gibi alternatif yapılandırmalar için bkz. Başlatma (C# SDK V1).

  • Bir nesnenin etiketlerini silmek için oss:DeleteObjectTagging iznine sahip olmanız gerekir. Daha fazla bilgi için bkz. Özel ilke atama.

Örnek kod

Aşağıdaki örnek kod, nesne etiketlerinin nasıl silineceğini gösterir:

using Aliyun.OSS;
using Aliyun.OSS.Common;

// Set yourEndpoint to the endpoint of the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com.
var endpoint = "yourEndpoint";
// Obtain access credentials from environment variables. Before running this sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set.
var accessKeyId = Environment.GetEnvironmentVariable("OSS_ACCESS_KEY_ID");
var accessKeySecret = Environment.GetEnvironmentVariable("OSS_ACCESS_KEY_SECRET");
// Specify the bucket name. For example, examplebucket.
var bucketName = "examplebucket";
// Specify the full path of the object. The full path cannot contain the bucket name. For example, exampledir/exampleobject.txt.
var objectName = "exampledir/exampleobject.txt";
// Specify the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the region to cn-hangzhou.
const string region = "cn-hangzhou";

// Create a ClientConfiguration instance and modify the default parameters as needed.
var conf = new ClientConfiguration();

// Set the signature version to V4.
conf.SignatureVersion = SignatureVersion.V4;

// Create an OssClient instance.
var client = new OssClient(endpoint, accessKeyId, accessKeySecret, conf);
client.SetRegion(region);
try
{
    // Delete the object tags.
    client.DeleteObjectTagging(bucketName,objectName);
    Console.WriteLine("Delete object tagging succeeded.");
}
catch (Exception ex)
{
    Console.WriteLine("Delete object tagging failed. {0}", ex.Message);
}

İlgili konular

DeleteObjectTagging API işlemi hakkında daha fazla bilgi için bkz. DeleteObjectTagging.