method setValueForKey

void setValueForKey(string key,value value);

Argumente

Zurückgegebener Wert

This method sets a value for a key in the key-value store. The type of the key-value pair will be set to the type of the value passed in to this method. If there is already a value associated with the key, then the new value's type will become the current type of the pair. No type-conversion is performed on the value being set.

The following example will set the value for three keys.
var factory = shell.serviceManager.localStorage.factory;
if (factory)
{
    var keyValueStore = factory.createKeyDatabaseForIdentity("johndoe", "aol.mail");
    if (keyValueStore)
    {
        keyValueStore.setValueForKey("awayMessage.1.name", "Meeting");
        keyValueStore.setValueForKey("awayMessage.1.message", "In a meeting.");
        keyValueStore.setValueForKey("awayMessage.1.default", false);
    }
}