SocketTools .NET Edition

WebStorage.PutData Method (String, Attributes, String)

Upload the text in a string to the storage container.

[Visual Basic]
Overloads Public Function PutData( _
   ByVal labelName As String, _
   ByVal objAttributes As Attributes, _
   ByVal textBuffer As String _
) As Boolean
[C#]
public bool PutData(
   string labelName,
   Attributes objAttributes,
   string textBuffer
);

Parameters

labelName
A string which specifies the label of the object that should be uploaded to the server. If an object with the same label already exists, it will be replaced with the contents of the buffer
objAttributes
An Attributes enumeration which specifies the attributes for the object being stored.
textBuffer
A string which contains the text to be stored.

Return Value

This method returns a boolean value. If the data has been uploaded to the storage server, it will return true, otherwise it will return false.

Remarks

The PutData method uploads the contents of a string to the current storage container. If the string contains non-ASCII characters, they will automatically converted to use UTF-8 encoding prior to being stored on the server. If a storage object exists with the same label, it will be replaced. During the transfer, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

Although storage object labels are similar to Windows file names, they are case-sensitive. When requesting information about an object, your application must specify the label name exactly as it was created using this method. The object label cannot contain wildcard characters.

If the label identifies an object that already exists in the container, and that object was created with the Attributes.ReadOnly attribute, this method will fail. To replace a read-only object, the application must explicitly move, rename or delete the existing object.

An appropriate content type will be determined automatically based on the label and the contents of the string. In most cases, the content type will default to text/plain.

This version of the PutData method should never be used to store binary data, particularly data that contains embedded null bytes. You should only use this method to store plain text. If you need to store binary data, use the version of PutData which accepts either a byte array or MemoryStream object.

If you wish to upload the contents of a file, use the PutFile method.

When this method returns, various properties such as ObjectId and ObjectLabel will be updated to reflect the values associated with the object that was created or replaced on the server.

See Also