CloudPageBlob.Create Method (Int64, BlobRequestOptions)

Storage Client Library NET API

[This topic is part of the Microsoft Azure Storage Client Library 1.7, which has been deprecated. See Storage Client Library for the latest version.]

Creates a page blob, using a conditional request based on the BlobRequestOptions specified.

Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)

Usage

Visual Basic
Dim instance As CloudPageBlob
Dim size As Long
Dim options As BlobRequestOptions

instance.Create(size, options)

Syntax

Visual Basic
Public Sub Create ( _
	size As Long, _
	options As BlobRequestOptions _
)
C#
public void Create (
	long size,
	BlobRequestOptions options
)
C++
public:
void Create (
	long long size, 
	BlobRequestOptions^ options
)
J#
JScript

Parameters

size

Type: System.Int64

The maximum size of the blob, in bytes. This value must be a multiple of 512.

options

An object that specifies any additional options for the request.

Example

The following code example creates a page blob that has a maximum size of 4 MB.

C# Copy Code
static void CreatePageBlob(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 the page blob.
    CloudPageBlob pageBlob = blobClient.GetPageBlobReference("mycontainer/mypageblob");

    //Create a page blob 4 MB in size.
    pageBlob.Create(4194304);

    //Verify that this is a page blob.
    pageBlob.FetchAttributes();
    Console.WriteLine(pageBlob.Properties.BlobType);
}

Remarks

To create a page blob, call Create, specifying the maximum size of the page blob in bytes. A page blob may be up to 1 TB in size.


Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Change History

See Also