CloudBlobContainer.GetPageBlobReference Method

 

Updated: February 24, 2017

Gets a reference to a page blob in this container.

Namespace:   Microsoft.WindowsAzure.Storage.Blob
Assembly:  Microsoft.WindowsAzure.Storage (in Microsoft.WindowsAzure.Storage.dll)

NameDescription
System_CAPS_pubmethodGetPageBlobReference(String)

Gets a reference to a page blob in this container.

System_CAPS_pubmethodGetPageBlobReference(String, Nullable<DateTimeOffset>)

Returns a reference to a page blob in this virtual directory.

Call this method to return a reference to a page blob in this container. Note that this method does not make a request against Blob storage. You can return a reference to the page blob whether or not it exists yet.

This example creates a new page blob, with two 512-byte pages.

private static async Task CreateNewPageBlob(CloudBlobContainer container)
{
    try
    {
        CloudPageBlob pageBlob = container.GetPageBlobReference("sample-page-blob");
        await pageBlob.CreateAsync(512 * 2 /*size*/); // size needs to be multiple of 512 bytes

        Console.WriteLine("Created new page blob {0}", pageBlob.Name);
    }
    catch (StorageException e)
    {
        Console.WriteLine(e.Message);
        Console.ReadLine();
        throw;
    }
}

Return to top
Show: