CloudBlob.UploadText Method (String)

Storage Client Library NET API

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

Uploads a string of text to a block blob.

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

Usage

Visual Basic
Dim instance As CloudBlob
Dim content As String

instance.UploadText(content)

Syntax

Visual Basic
Public Overridable Sub UploadText ( _
	content As String _
)
C#
public virtual void UploadText (
	string content
)
C++
public:
virtual void UploadText (
	String^ content
)
J#
JScript

Parameters

content

Type: System.String

The text to upload, which will be encoded as a UTF-8 string.

Example

The following code example uploads a blob from text. This example overwrites the blob if it already exists in the container.

C# Copy Code
static void UploadBlobFromText(Uri blobEndpoint, string accountName, string accountKey)
{
    // Create service client for credentialed access to the blob.
    CloudBlobClient blobClient = 
        new CloudBlobClient(blobEndpoint, 
            new StorageCredentialsAccountAndKey(accountName, accountKey));

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

    // Upload the blob from a text string.
    blob.UploadText("Upload a blob from text.");
}

Thread Safety

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

Platforms

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Change History

See Also