VERTRIEB: 1-800-867-1380
EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

CloudStorageAccount.Parse Method

Updated: September 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.]

Parses a connection string and returns a CloudStorageAccount created from the connection string.

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

'Usage
Dim value As String
Dim returnValue As CloudStorageAccount

returnValue = CloudStorageAccount.Parse(value)

public static CloudStorageAccount Parse (
	string value
)

Parameters

value

Type: System.String

A valid connection string.

Return Value

Type: Microsoft.WindowsAzure.CloudStorageAccount

A CloudStorageAccount object constructed from the values provided in the connection string.

The following code example parses a connection string and returns a CloudStorageAccount object, then lists account, credential, and endpoint information.

static void ParseCloudStorageAccountFromConnectionString()
{
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageAccountConnectionString"]);

    Console.WriteLine("Connection string: {0}", storageAccount.ToString(true));
    Console.WriteLine("Account name: {0}", storageAccount.Credentials.AccountName);
    Console.WriteLine("Account key: {0}", ((StorageCredentialsAccountAndKey)storageAccount.Credentials).Credentials.ExportBase64EncodedKey());
    Console.WriteLine("Blob endpoint: {0}", storageAccount.BlobEndpoint);
    Console.WriteLine("Queue endpoint: {0}", storageAccount.QueueEndpoint);
    Console.WriteLine("Table endpoint: {0}", storageAccount.TableEndpoint);
}

Exception typeCondition
ArgumentNullException

Thrown if value is null or empty.

FormatException

Thrown if value is not a valid connection string.

ArgumentException

Thrown if value cannot be parsed.

The Parse method parses a connection string and returns a reference to a CloudStorageAccount object. For details on working with connection strings, see How to Configure Connection Strings.


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

 

Fanden Sie dies hilfreich?
(1500 verbleibende Zeichen)
Vielen Dank für Ihr Feedback.
Anzeigen:
© 2014 Microsoft