Storage.CreateNewObject method

The CreateNewObject method creates and initializes a WPDObject to the specified data format.

Syntax

retVal = Storage.CreateNewObject(
  Format
)

Parameters

Format

A string that is the data format of the new WPDObject.

Return value

Returns a Creation Container object that is used to set properties and data. When the Creation Container is passed to the Storage.AddChild method, a new WPDObject containing the properties and data of the specified data format will be added as the child of a Storage object.

Examples

The following JScript example uses the CreateNewObject method to add a newly created storage object (a "VCard2" formatted contact) as a child of another storage object. In this example, contact is the Creation Container that is used to set the properties ContactDisplayName, and ContactMobilePhone. When contact is added as a child of the storage object, it becomes a new WPDObject object that represents a contact on the device, and the property values are persisted.

// Create a new storage object of the "Vcard2" format.
var contact = storage.CreateNewObject("Vcard2");
contact.ContactDisplayName = "Bob";
contact.ContactMobilePhone = "(206)555-1234";

// Add the new contact as a child of the storage object.
// Note that the new object will not be persisted until
// it is added by using this method.
storage.AddChild(contact);

Requirements

Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
Windows Server 2008 R2 [desktop apps only]

See also

Storage Object

WPDObject