我只是想知道是否可以设置和检索元数据
关于存储在该容器内目录中的blob?
是的,你当然可以这样做。请参见下面的示例代码:
const string ConnectionString = "DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key";
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConnectionString);
//Create the service client object for credentialed access to the Blob service.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
CloudBlockBlob blob = container.GetBlockBlobReference("images/logo.png");
blob.FetchAttributes();//Gets the properties & metadata for the blob.
blob.Metadata.Add("Key", "Value");
blob.SetMetadata();//Saves the metadata.