你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
CloudBlobContainer.GetBlockBlobReference 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
GetBlockBlobReference(String) |
获取对此容器中的块 Blob 的引用。 |
GetBlockBlobReference(String, Nullable<DateTimeOffset>) |
获取对此容器中的块 Blob 的引用。 |
GetBlockBlobReference(String)
获取对此容器中的块 Blob 的引用。
public virtual Microsoft.Azure.Storage.Blob.CloudBlockBlob GetBlockBlobReference (string blobName);
abstract member GetBlockBlobReference : string -> Microsoft.Azure.Storage.Blob.CloudBlockBlob
override this.GetBlockBlobReference : string -> Microsoft.Azure.Storage.Blob.CloudBlockBlob
Public Overridable Function GetBlockBlobReference (blobName As String) As CloudBlockBlob
参数
- blobName
- String
一个包含块 Blob 名称的字符串。
返回
CloudBlockBlob 对象。
示例
// This is one common way of creating a CloudStorageAccount object. You can get
// your Storage Account Name and Key from the Azure Portal.
StorageCredentials credentials = new StorageCredentials(accountName, accountKey);
CloudStorageAccount storageAccount = new CloudStorageAccount(credentials, useHttps: true);
// Another common way to create a CloudStorageAccount object is to use a connection string:
// CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// This call creates a local CloudBlobContainer object, but does not make a network call
// to the Azure Storage Service. The container on the service that this object represents may
// or may not exist at this point. If it does exist, the properties will not yet have been
// popluated on this object.
CloudBlobContainer blobContainer = blobClient.GetContainerReference(containerName);
// This makes an actual service call to the Azure Storage service. Unless this call fails,
// the container will have been created.
blobContainer.Create();
// This also does not make a service call, it only creates a local object.
CloudBlockBlob blob = blobContainer.GetBlockBlobReference(blobName);
// This transfers data in the file to the blob on the service.
blob.UploadFromFile(inputFileName);
适用于
GetBlockBlobReference(String, Nullable<DateTimeOffset>)
获取对此容器中的块 Blob 的引用。
public virtual Microsoft.Azure.Storage.Blob.CloudBlockBlob GetBlockBlobReference (string blobName, DateTimeOffset? snapshotTime);
abstract member GetBlockBlobReference : string * Nullable<DateTimeOffset> -> Microsoft.Azure.Storage.Blob.CloudBlockBlob
override this.GetBlockBlobReference : string * Nullable<DateTimeOffset> -> Microsoft.Azure.Storage.Blob.CloudBlockBlob
Public Overridable Function GetBlockBlobReference (blobName As String, snapshotTime As Nullable(Of DateTimeOffset)) As CloudBlockBlob
参数
- blobName
- String
一个包含块 Blob 名称的字符串。
- snapshotTime
- Nullable<DateTimeOffset>
用于指定快照时间戳的 DateTimeOffset(如果 Blob 是快照)。
返回
CloudBlockBlob 对象。