I
InsightNexus

Class QueueClient | Azure SDK for Net

Author

Andrew Henderson

Published Feb 16, 2026

A QueueClient represents a URI to the Azure Storage Queue service allowing you to manipulate a queue.

Inheritance

QueueClient

Namespace: Azure.Storage.Queues
Assembly: Azure.Storage.Queues.dll
Syntax
public class QueueClient

Constructors

QueueClient()

Initializes a new instance of the QueueClientclass for mocking.

Declaration
protected QueueClient ();

QueueClient(String, String)

Declaration
public QueueClient (string connectionString, string queueName);
Parameters
String connectionString

A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.

For more information, seeConfigure Azure Storage connection strings.

String queueName

The name of the queue in the storage account to reference.

QueueClient(Uri, QueueClientOptions)

Declaration
public QueueClient (Uri queueUri, Azure.Storage.Queues.QueueClientOptions options = null);
Parameters
Uri queueUri

A Uri referencing the queue that includes the name of the account, and the name of the queue. This is likely to be similar to "".

QueueClientOptions options

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

QueueClient(String, String, QueueClientOptions)

Declaration
public QueueClient (string connectionString, string queueName, Azure.Storage.Queues.QueueClientOptions options);
Parameters
String connectionString

A connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.

For more information, seeConfigure Azure Storage connection strings.

String queueName

The name of the queue in the storage account to reference.

QueueClientOptions options

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

QueueClient(Uri, TokenCredential, QueueClientOptions)

Declaration
public QueueClient (Uri queueUri, Azure.Core.TokenCredential credential, Azure.Storage.Queues.QueueClientOptions options = null);
Parameters
Uri queueUri

A Uri referencing the queue that includes the name of the account, and the name of the queue. This is likely to be similar to "".

TokenCredential credential

The token credential used to sign requests.

QueueClientOptions options

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

QueueClient(Uri, StorageSharedKeyCredential, QueueClientOptions)

Declaration
public QueueClient (Uri queueUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Queues.QueueClientOptions options = null);
Parameters
Uri queueUri

A Uri referencing the queue that includes the name of the account, and the name of the queue. This is likely to be similar to "".

StorageSharedKeyCredential credential

The shared key credential used to sign requests.

QueueClientOptions options

Optional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

Properties

AccountName

Gets the Storage account name corresponding to the queue client.

Declaration
public virtual string AccountName { get; }
Property Value

MaxPeekableMessages

QueueMaxMessagesPeek indicates the maximum number of messages you can retrieve with each call to Peek.

Declaration
public virtual int MaxPeekableMessages { get; }
Property Value

MessageMaxBytes

Gets the maximum number of bytes allowed for a message's UTF-8 text.

Declaration
public virtual int MessageMaxBytes { get; }
Property Value

MessagesUri

Gets the Uri endpoint used by the object's messages.

Declaration
protected virtual Uri MessagesUri { get; }
Property Value

Name

Gets the name of the queue.

Declaration
public virtual string Name { get; }
Property Value

Uri

Gets the Uri endpoint used by the object.

Declaration
public virtual Uri Uri { get; }
Property Value

Methods

ClearMessages(CancellationToken)

Deletes all messages from a queue.

For more information, seeClear Messages.

Declaration
public virtual Azure.Response ClearMessages (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

ClearMessagesAsync(CancellationToken)

Deletes all messages from a queue.

For more information, seeClear Messages.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response> ClearMessagesAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

Create(IDictionary<String,String>, CancellationToken)

Declaration
public virtual Azure.Response Create (System.Collections.Generic.IDictionary<string,string> metadata = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

CreateAsync(IDictionary<String,String>, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response> CreateAsync (System.Collections.Generic.IDictionary<string,string> metadata = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

CreateIfNotExists(IDictionary<String,String>, CancellationToken)

Declaration
public virtual Azure.Response CreateIfNotExists (System.Collections.Generic.IDictionary<string,string> metadata = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns
Response

If the queue does not already exist, a Responsedescribing the newly created queue. If the queue already exists, null.

CreateIfNotExistsAsync(IDictionary<String,String>, CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response> CreateIfNotExistsAsync (System.Collections.Generic.IDictionary<string,string> metadata = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns
Task<Response>

If the queue does not already exist, a Responsedescribing the newly created queue. If the queue already exists, null.

Delete(CancellationToken)

Declaration
public virtual Azure.Response Delete (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteAsync(CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteIfExists(CancellationToken)

Declaration
public virtual Azure.Response<bool> DeleteIfExists (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteIfExistsAsync(CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<bool>> DeleteIfExistsAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

DeleteMessage(String, String, CancellationToken)

Permanently removes the specified message from its queue.

For more information, seeDelete Message.

Declaration
public virtual Azure.Response DeleteMessage (string messageId, string popReceipt, System.Threading.CancellationToken cancellationToken = null);
Parameters
String messageId

ID of the message to delete.

String popReceipt

Required. A valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation.

CancellationToken cancellationToken

Optional CancellationToken.

Returns

DeleteMessageAsync(String, String, CancellationToken)

Permanently removes the specified message from its queue.

For more information, seeDelete Message.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteMessageAsync (string messageId, string popReceipt, System.Threading.CancellationToken cancellationToken = null);
Parameters
String messageId

ID of the message to delete.

String popReceipt

Required. A valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation.

CancellationToken cancellationToken

Optional CancellationToken.

Returns

Exists(CancellationToken)

Declaration
public virtual Azure.Response<bool> Exists (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

ExistsAsync(CancellationToken)

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<bool>> ExistsAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

GetAccessPolicy(CancellationToken)

Returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures.

For more information, seeGet Queue ACL.

Declaration
public virtual Azure.Response<System.Collections.Generic.IEnumerable<Azure.Storage.Queues.Models.QueueSignedIdentifier>> GetAccessPolicy (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

GetAccessPolicyAsync(CancellationToken)

Returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures.

For more information, seeGet Queue ACL.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IEnumerable<Azure.Storage.Queues.Models.QueueSignedIdentifier>>> GetAccessPolicyAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

GetProperties(CancellationToken)

Retrieves queue properties and user-defined metadata and properties on the specified queue. Metadata is associated with the queue as name-values pairs.

For more information, seeGet Queue Metadata.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.QueueProperties> GetProperties (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

GetPropertiesAsync(CancellationToken)

Retrieves queue properties and user-defined metadata and properties on the specified queue. Metadata is associated with the queue as name-values pairs.

For more information, seeGet Queue Metadata.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.QueueProperties>> GetPropertiesAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

PeekMessage(CancellationToken)

Retrieves one message from the front of the queue but does not alter the visibility of the message.

For more information, seePeek Messages.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.PeekedMessage> PeekMessage (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

PeekMessageAsync(CancellationToken)

Retrieves one message from the front of the queue but does not alter the visibility of the message.

For more information, seePeek Messages.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.PeekedMessage>> PeekMessageAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

PeekMessages(Nullable<Int32>, CancellationToken)

Retrieves one or more messages from the front of the queue but does not alter the visibility of the message.

For more information, seePeek Messages.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.PeekedMessage[]> PeekMessages (Nullable<int> maxMessages = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Nullable<Int32> maxMessages

Optional. A nonzero integer value that specifies the number of messages to peek from the queue, up to a maximum of 32. By default, a single message is peeked from the queue with this operation.

CancellationToken cancellationToken

Optional CancellationToken

Returns

PeekMessagesAsync(Nullable<Int32>, CancellationToken)

Retrieves one or more messages from the front of the queue but does not alter the visibility of the message.

For more information, seePeek Messages.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.PeekedMessage[]>> PeekMessagesAsync (Nullable<int> maxMessages = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Nullable<Int32> maxMessages

Optional. A nonzero integer value that specifies the number of messages to peek from the queue, up to a maximum of 32. By default, a single message is peeked from the queue with this operation.

CancellationToken cancellationToken

Optional CancellationToken

Returns

ReceiveMessage(Nullable<TimeSpan>, CancellationToken)

Receives one message from the front of the queue.

For more information, seeGet Messages.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.QueueMessage> ReceiveMessage (Nullable<TimeSpan> visibilityTimeout = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

ReceiveMessageAsync(Nullable<TimeSpan>, CancellationToken)

Retrieves one message from the front of the queue.

For more information, seeGet Messages.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.QueueMessage>> ReceiveMessageAsync (Nullable<TimeSpan> visibilityTimeout = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

ReceiveMessages()

Receives one or more messages from the front of the queue.

For more information, seeGet Messages.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.QueueMessage[]> ReceiveMessages ();
Returns

ReceiveMessages(CancellationToken)

Receives one or more messages from the front of the queue.

For more information, seeGet Messages.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.QueueMessage[]> ReceiveMessages (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

ReceiveMessages(Nullable<Int32>, Nullable<TimeSpan>, CancellationToken)

Receives one or more messages from the front of the queue.

For more information, seeGet Messages.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.QueueMessage[]> ReceiveMessages (Nullable<int> maxMessages = null, Nullable<TimeSpan> visibilityTimeout = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Nullable<Int32> maxMessages

Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation.

Nullable<TimeSpan> visibilityTimeout

Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds.

CancellationToken cancellationToken

Optional CancellationToken

Returns

ReceiveMessagesAsync(CancellationToken)

Retrieves one or more messages from the front of the queue.

For more information, seeGet Messages.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.QueueMessage[]>> ReceiveMessagesAsync (System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

ReceiveMessagesAsync(Nullable<Int32>, Nullable<TimeSpan>, CancellationToken)

Retrieves one or more messages from the front of the queue.

For more information, seeGet Messages.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.QueueMessage[]>> ReceiveMessagesAsync (Nullable<int> maxMessages = null, Nullable<TimeSpan> visibilityTimeout = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Nullable<Int32> maxMessages

Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation.

Nullable<TimeSpan> visibilityTimeout

Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds.

CancellationToken cancellationToken

Optional CancellationToken

Returns

ReceiveMessagesAsync()

Retrieves one or more messages from the front of the queue.

For more information, seeGet Messages.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.QueueMessage[]>> ReceiveMessagesAsync ();
Returns

SendMessage(String)

Adds a new message to the back of a queue. The visibility timeout specifies how long the message should be invisible to Dequeue and Peek operations. The message content must be a UTF-8 encoded string that is up to 64KB in size.

For more information, seePut Message.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.SendReceipt> SendMessage (string messageText);
Parameters
String messageText

Message text.

Returns

SendMessage(String, CancellationToken)

Adds a new message to the back of a queue. The visibility timeout specifies how long the message should be invisible to Dequeue and Peek operations. The message content must be a UTF-8 encoded string that is up to 64KB in size.

For more information, seePut Message.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.SendReceipt> SendMessage (string messageText, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

SendMessage(String, Nullable<TimeSpan>, Nullable<TimeSpan>, CancellationToken)

Adds a new message to the back of a queue. The visibility timeout specifies how long the message should be invisible to Dequeue and Peek operations. The message content must be a UTF-8 encoded string that is up to 64KB in size.

For more information, seePut Message.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.SendReceipt> SendMessage (string messageText, Nullable<TimeSpan> visibilityTimeout = null, Nullable<TimeSpan> timeToLive = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

SendMessageAsync(String)

Adds a new message to the back of a queue. The visibility timeout specifies how long the message should be invisible to Dequeue and Peek operations. The message content must be a UTF-8 encoded string that is up to 64KB in size.

For more information, seePut Message.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.SendReceipt>> SendMessageAsync (string messageText);
Parameters
String messageText

Message text.

Returns

SendMessageAsync(String, CancellationToken)

Adds a new message to the back of a queue. The visibility timeout specifies how long the message should be invisible to Dequeue and Peek operations. The message content must be a UTF-8 encoded string that is up to 64KB in size.

For more information, seePut Message.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.SendReceipt>> SendMessageAsync (string messageText, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

SendMessageAsync(String, Nullable<TimeSpan>, Nullable<TimeSpan>, CancellationToken)

Adds a new message to the back of a queue. The visibility timeout specifies how long the message should be invisible to Dequeue and Peek operations. The message content must be a UTF-8 encoded string that is up to 64KB in size.

For more information, seePut Message.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.SendReceipt>> SendMessageAsync (string messageText, Nullable<TimeSpan> visibilityTimeout = null, Nullable<TimeSpan> timeToLive = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

SetAccessPolicy(IEnumerable<QueueSignedIdentifier>, CancellationToken)

SetAccessPolicyAsync sets stored access policies for the queue that may be used with Shared Access Signatures.

For more information, seeSet Queue ACL.

Declaration
public virtual Azure.Response SetAccessPolicy (System.Collections.Generic.IEnumerable<Azure.Storage.Queues.Models.QueueSignedIdentifier> permissions, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

SetAccessPolicyAsync(IEnumerable<QueueSignedIdentifier>, CancellationToken)

SetAccessPolicyAsync sets stored access policies for the queue that may be used with Shared Access Signatures.

For more information, seeSet Queue ACL.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response> SetAccessPolicyAsync (System.Collections.Generic.IEnumerable<Azure.Storage.Queues.Models.QueueSignedIdentifier> permissions, System.Threading.CancellationToken cancellationToken = null);
Parameters
Returns

SetMetadata(IDictionary<String,String>, CancellationToken)

SetMetadataAsync(IDictionary<String,String>, CancellationToken)

UpdateMessage(String, String, String, TimeSpan, CancellationToken)

Changes a message's visibility timeout and contents. The message content must be a UTF-8 encoded string that is up to 64KB in size.

For more information, seeUpdate Message.

Declaration
public virtual Azure.Response<Azure.Storage.Queues.Models.UpdateReceipt> UpdateMessage (string messageId, string popReceipt, string messageText = null, TimeSpan visibilityTimeout = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
String messageId

ID of the message to update.

String popReceipt

Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation.

String messageText

Optional. Updated message text.

TimeSpan visibilityTimeout

Required. Specifies the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. A message can be updated until it has been deleted or has expired.

CancellationToken cancellationToken

Optional CancellationToken.

Returns

UpdateMessageAsync(String, String, String, TimeSpan, CancellationToken)

Changes a message's visibility timeout and contents. The message content must be a UTF-8 encoded string that is up to 64KB in size.

For more information, seeUpdate Message.

Declaration
[System.Diagnostics.DebuggerStepThrough]
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Queues.Models.UpdateReceipt>> UpdateMessageAsync (string messageId, string popReceipt, string messageText = null, TimeSpan visibilityTimeout = null, System.Threading.CancellationToken cancellationToken = null);
Parameters
String messageId

ID of the message to update.

String popReceipt

Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation.

String messageText

Optional. Updated message text.

TimeSpan visibilityTimeout

Required. Specifies the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. A message can be updated until it has been deleted or has expired.

CancellationToken cancellationToken

Optional CancellationToken.

Returns

Extension Methods