Cloud​Blob​Container.​Create Method

Definition

Overloads

Create(​Blob​Request​Options, ​Operation​Context)

Creates the container.

Create(​Blob​Container​Public​Access​Type, ​Blob​Request​Options, ​Operation​Context)

Creates the container and specifies the level of access to the container's data.

Create(BlobRequestOptions, OperationContext)

Creates the container.

[Microsoft.WindowsAzure.Storage.DoesServiceRequest]
public virtual void Create (Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions requestOptions = null, Microsoft.WindowsAzure.Storage.OperationContext operationContext = null);
Parameters
requestOptions
BlobRequestOptions

A BlobRequestOptions object that specifies additional options for the request.

operationContext
OperationContext

An OperationContext object that represents the context for the current operation.

Attributes

Examples

// 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);

Create(BlobContainerPublicAccessType, BlobRequestOptions, OperationContext)

Creates the container and specifies the level of access to the container's data.

[Microsoft.WindowsAzure.Storage.DoesServiceRequest]
public virtual void Create (Microsoft.WindowsAzure.Storage.Blob.BlobContainerPublicAccessType accessType, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions requestOptions = null, Microsoft.WindowsAzure.Storage.OperationContext operationContext = null);
Parameters
accessType
BlobContainerPublicAccessType

An BlobContainerPublicAccessType object that specifies whether data in the container may be accessed publicly and what level of access is to be allowed.

requestOptions
BlobRequestOptions

A BlobRequestOptions object that specifies additional options for the request.

operationContext
OperationContext

An OperationContext object that represents the context for the current operation.

Attributes