导出 (0) 打印
全部展开

CloudBlob.FetchAttributes 方法 (BlobRequestOptions)

Populates a blob's properties and metadata.

命名空间: Microsoft.WindowsAzure.StorageClient
程序集: Microsoft.WindowsAzure.StorageClient(在 microsoft.windowsazure.storageclient.dll 中)

用法
Dim instance As CloudBlob
Dim options As BlobRequestOptions

instance.FetchAttributes(options)

声明
Public Sub FetchAttributes ( _
	options As BlobRequestOptions _
)
public void FetchAttributes (
	BlobRequestOptions options
)
public function FetchAttributes (
	options : BlobRequestOptions
)

参数

options

An object that specifies any additional options for the request.

The following code example lists blob properties and metadata.

static void ListBlobPropertiesAndMetadata(Uri blobEndpoint, string accountName, string accountKey)
{
    //Create service client for credentialed access to the Blob service.
    CloudBlobClient blobClient = new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));

    //Get a reference to a blob.
    CloudBlob blob = blobClient.GetBlobReference("mycontainer/myblob.txt");

    //Populate the blob's attributes.
    blob.FetchAttributes();

    //List some blob properties.
    Console.WriteLine("Blob: " + blob.Attributes.Uri);
    Console.WriteLine();

    Console.WriteLine("Blob properties:");
    Console.WriteLine("\tBlobType: " + blob.Attributes.Properties.BlobType);
    Console.WriteLine("\tLastModifiedUTC: " + blob.Attributes.Properties.LastModifiedUtc);
    Console.WriteLine("\tETag: " + blob.Attributes.Properties.ETag);
    Console.WriteLine();

    //Enumerate the blob's metadata.
    foreach (var metadataKey in blob.Metadata.Keys)
    {
        Console.WriteLine("Metadata name: " + metadataKey.ToString());
        Console.WriteLine("Metadata value: " + blob.Metadata.Get(metadataKey.ToString()));
    }
}


The FetchAttributes method populates the blob's system properties and user-defined metadata. Before reading a blob's properties or metadata, you should always call this method or the BeginFetchAttributes method to retrieve the latest values for the blob's properties and metadata from the service.


此类型的任何公共静态(在 Visual Basic 中为 Shared)成员都是线程安全的。但不保证所有实例成员都是线程安全的。

开发平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目标平台

社区附加资源

显示:
© 2014 Microsoft