This topic has not yet been rated - Rate this topic

BlobRequestOptions.AccessCondition Property

Gets or sets the access condition for the request.

Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)
'Usage
Dim instance As BlobRequestOptions
Dim value As AccessCondition

value = instance.AccessCondition

instance.AccessCondition = value
public AccessCondition AccessCondition { get; set; }
/** @property */
/** @attribute CompilerGeneratedAttribute() */ 
public AccessCondition get_AccessCondition ()

/** @property */
/** @attribute CompilerGeneratedAttribute() */ 
public void set_AccessCondition (AccessCondition value)

CompilerGeneratedAttribute 
public function get AccessCondition () : AccessCondition

CompilerGeneratedAttribute 
public function set AccessCondition (value : AccessCondition)

Property Value

Type: Microsoft.WindowsAzure.StorageClient.AccessCondition

A structure that specifies any conditional parameters on the request.

The following example deletes a blob if its ETag matches a specified value.

static void DeleteIfMatch(Uri blobEndpoint, string accountName, string accountKey, string eTag)
{
    CloudBlobClient blobClient =
        new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));

    //Get a reference to the blob.
    CloudBlob blob = blobClient.GetBlobReference("mycontainer/myblob.txt");

    //Indicate that any snapshots should be deleted.
    BlobRequestOptions options = new BlobRequestOptions();
    options.DeleteSnapshotsOption = DeleteSnapshotsOption.IncludeSnapshots;

    //Specify the if-match condition. The blob will be deleted if its ETag matches the value passed in.
    options.AccessCondition = AccessCondition.IfMatch(eTag);

    //Delete the blob if the condition is met.
    blob.Delete(options);
}


The default access condition for any request is None.

An access condition may specify a condition that must be met for the operation to be performed by the service. The AccessCondition structure provides methods that can be used to specify exactly one of the following access conditions:

  • If-Match, which performs an operation only if the specified Etag value matches the blob's Etag value. Use the IfMatch method to return this access condition.

  • If-None-Match, which performs an operation only if the specified Etag value does not match the blob's Etag value. Use the IfNoneMatch method to return this access condition.

  • If-Modified-Since, which performs an operation only if the resource has been modified since the specified date and time. Use the IfModifiedSince method to return this access condition.

  • If-Not-Modified-Since, which performs an operation only if the resource has not been modified since the specified date and time. Use the IfNotModifiedSince method to return this access condition.


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

Development Platforms

Windows Vista, Windows 7 and Windows Server 2008

Target Platforms

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ