匯出 (0) 列印
全部展開
EN
本內容沒有您的語言版本,但有英文版本。

BlobRequestOptions.AccessCondition Property

Updated: April 24, 2013

[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.]

Gets or sets the access condition for the request.

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

'用途
Dim instance As BlobRequestOptions
Dim value As AccessCondition

value = instance.AccessCondition

instance.AccessCondition = value

public:
property AccessCondition AccessCondition {
	AccessCondition get ();
	void set (AccessCondition value);
}

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, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

 

顯示:
© 2014 Microsoft