ApplicationDataContainerSettings.Lookup | lookup method

Applies to Windows and Windows Phone

Retrieves the specified application setting.

Syntax


var object = applicationDataContainerSettings.lookup(key);

Parameters

key

Type: String [JavaScript] | Platform::String [C++]

The key of the setting.

Return value

Type: Object [JavaScript] | Platform::Object [C++]

The application setting.

Examples

Call the ApplicationDataContainer.CreateContainer method to create a settings container. This example creates a settings container named exampleContainer and adds a setting named exampleSetting. The Always value from the ApplicationDataCreateDisposition enumeration indicates that the container should be created if it does not already exist.

Use the ApplicationDataContainer.values property to access the exampleSetting setting in the exampleContainer container.

Call the ApplicationDataContainer.deleteContainer method to delete the exampleContainer settings container when you have finished with it.


var applicationData = Windows.Storage.ApplicationData.current;

var localSettings = applicationData.localSettings;

// Create a setting in a container

var container = localSettings.createContainer("exampleContainer", 
    Windows.Storage.ApplicationDataCreateDisposition.Always);

if (localSettings.containers.hasKey("exampleContainer"))
{
    localSettings.containers.lookup("exampleContainer").values["exampleSetting"] = "Hello Windows";
}

// Read data from a setting in a container

var hasContainer = localSettings.containers.hasKey("exampleContainer");

if (hasContainer)
{
    // Access data in: 
    //   localSettings.containers.lookup("exampleContainer").values.hasKey("exampleSetting");
}

// Delete a container

localSettings.deleteContainer("exampleContainer");


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Storage
Windows::Storage [C++]

Metadata

Windows.winmd

DLL

Windows.Storage.ApplicationData.dll

See also

Tasks
Quickstart: Local application data (JavaScript)
Quickstart: Local application data (C#/VB/C++)
Quickstart: Roaming application data (JavaScript)
Quickstart: Roaming application data (C#/VB/C++)
Concepts
Application data overview
Reference
ApplicationDataContainerSettings

 

 

Show:
© 2014 Microsoft