共用方式為


BlobContainerClient.CreateIfNotExists Method

Definition

The CreateIfNotExists(PublicAccessType, IDictionary<String,String>, BlobContainerEncryptionScopeOptions, CancellationToken) operation creates a new container under the specified account. If the container with the same name already exists, it is not changed.

For more information, see Create Container.

public virtual Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo> CreateIfNotExists (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 CreateIfNotExists : Azure.Storage.Blobs.Models.PublicAccessType * System.Collections.Generic.IDictionary<string, string> * Azure.Storage.Blobs.Models.BlobContainerEncryptionScopeOptions * System.Threading.CancellationToken -> Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo>
override this.CreateIfNotExists : Azure.Storage.Blobs.Models.PublicAccessType * System.Collections.Generic.IDictionary<string, string> * Azure.Storage.Blobs.Models.BlobContainerEncryptionScopeOptions * System.Threading.CancellationToken -> Azure.Response<Azure.Storage.Blobs.Models.BlobContainerInfo>
Public Overridable Function CreateIfNotExists (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 Response(Of BlobContainerInfo)

Parameters

publicAccessType
PublicAccessType

Optionally specifies whether data in the container may be accessed publicly and the level of access. BlobContainer specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account. Blob specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request. None specifies that the container data is private to the account owner.

metadata
IDictionary<String,String>

Optional custom metadata to set for this container.

encryptionScopeOptions
BlobContainerEncryptionScopeOptions

Optional encryption scope options to set for this container.

cancellationToken
CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

If the container does not already exist, a Response<T> describing the newly created container. If the container already exists, null.

Remarks

A RequestFailedException will be thrown if a failure occurs.

Applies to