Экспорт (0) Печать
Развернуть все
EN
Данное содержимое не доступно на вашем языке, используйте версию на английском языке.

CloudQueueClient.ListQueues Method (String, QueueListingDetails)

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

Returns an enumerable collection of the queues in the storage account whose names begin with the specified prefix and that are retrieved lazily.

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

'Применение
Dim instance As CloudQueueClient
Dim prefix As String
Dim detailsIncluded As QueueListingDetails
Dim returnValue As IEnumerable(Of CloudQueue)

returnValue = instance.ListQueues(prefix, detailsIncluded)

public IEnumerable<CloudQueue> ListQueues (
	string prefix,
	QueueListingDetails detailsIncluded
)

Parameters

prefix

Type: System.String

The queue name prefix.

detailsIncluded

Type: Microsoft.WindowsAzure.StorageClient.QueueListingDetails

One of the enumeration values that indicates which details to include in the listing.

Return Value

Type: System.Collections.Generic.IEnumerable

An enumerable collection of queues that are retrieved lazily.

The following code example lists all of the queues in the account, next lists queues beginning with a specified prefix, and finally lists queues with metadata included in the listing.

static void ListQueuesInAccount(Uri queueEndpoint, string accountName, string accountKey)
{
    //Create service client for credentialed access to the Queue service.
    CloudQueueClient queueClient = new CloudQueueClient(queueEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));

    //List all of the queues in account.
    foreach(var queue in queueClient.ListQueues())
    {
        Console.WriteLine(queue.Name);
    }
    Console.WriteLine();

    //List all of the queues in account beginning with the specified prefix.
    foreach(var queue in queueClient.ListQueues("my"))
    {
        Console.WriteLine(queue.Name);
    }
    Console.WriteLine();

    //List all of the queues in account beginning with the specified prefix, and also return queue metadata.
    foreach (var queue in queueClient.ListQueues("my", QueueListingDetails.Metadata))
    {
        Console.WriteLine(queue.Name);

        //Enumerate the queue's metadata.
        foreach (var metadataKey in queue.Metadata.Keys)
        {
            Console.WriteLine("\tMetadata name: " + metadataKey.ToString());
            Console.WriteLine("\tMetadata value: " + queue.Metadata.Get(metadataKey.ToString()));
        }
    }
    Console.WriteLine();
}


The ListQueues method will return all queues in the storage account. The ListQueues method enumerates queues lazily, so results are retrieved from the server as they are needed.

To list queues in pages of a specified size, use the ListQueuesSegmented or BeginListQueuesSegmented method.


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

 

Корпорация Майкрософт проводит интернет-опрос, чтобы выяснить ваше мнение о веб-сайте MSDN. Если вы желаете принять участие в этом интернет-опросе, он будет отображен при закрытии веб-сайта MSDN.

Вы хотите принять участие?
Показ:
© 2014 Microsoft