你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

BlobContainerClient.CreateIfNotExistsAsync 方法

定义

CreateIfNotExistsAsync(PublicAccessType, IDictionary<String,String>, BlobContainerEncryptionScopeOptions, CancellationToken)操作在指定帐户下创建一个新容器。 如果同名的容器已存在,则不会更改该容器。

有关详细信息,请参阅 创建容器

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo>> CreateIfNotExistsAsync (Azure.Storage.Blobs.Models.PublicAccessType publicAccessType = Azure.Storage.Blobs.Models.PublicAccessType.None, System.Collections.Generic.IDictionary<string,string> metadata = default, Azure.Storage.Blobs.Models.BlobContainerEncryptionScopeOptions encryptionScopeOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateIfNotExistsAsync : Azure.Storage.Blobs.Models.PublicAccessType * System.Collections.Generic.IDictionary<string, string> * Azure.Storage.Blobs.Models.BlobContainerEncryptionScopeOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo>>
override this.CreateIfNotExistsAsync : Azure.Storage.Blobs.Models.PublicAccessType * System.Collections.Generic.IDictionary<string, string> * Azure.Storage.Blobs.Models.BlobContainerEncryptionScopeOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo>>
Public Overridable Function CreateIfNotExistsAsync (Optional publicAccessType As PublicAccessType = Azure.Storage.Blobs.Models.PublicAccessType.None, Optional metadata As IDictionary(Of String, String) = Nothing, Optional encryptionScopeOptions As BlobContainerEncryptionScopeOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of BlobContainerInfo))

参数

publicAccessType
PublicAccessType

(可选)指定是否可以公开访问容器中的数据以及访问级别。 BlobContainer 指定对容器和 Blob 数据的完全公共读取访问权限。 客户端可以通过匿名请求枚举容器中的 Blob,但无法枚举存储帐户中的容器。 Blob 指定 Blob 的公共读取访问权限。 可以通过匿名请求读取此容器中的 Blob 数据,但容器数据不可用。 客户端无法通过匿名请求枚举容器中的 Blob。 None 指定容器数据对帐户所有者是专用的。

metadata
IDictionary<String,String>

要为此容器设置的可选自定义元数据。

encryptionScopeOptions
BlobContainerEncryptionScopeOptions

要为此容器设置的可选加密范围选项。

cancellationToken
CancellationToken

可选 CancellationToken ,用于传播应取消操作的通知。

返回

描述 Response<T> 新创建的容器的 。

注解

RequestFailedException如果失败,将引发 。

适用于