Storage.AddChild method

The AddChild method adds a WPDObject obtained from the Storage.CreateNewObject method, as a child of this Storage object.

Syntax

Storage.AddChild(
  creationContainerObject
)

Parameters

creationContainerObject

A creationContainer that is used to set data in a WPDObject so that it can be added as a child of this Storage object.

Return value

If called in synchronous mode, this method returns the newly created child object. If called in asynchronous mode, this method does not return a value. The newly created child object is provided as a parameter to the handler-function assigned to the onAddChildComplete event.

Remarks

To enable asynchronous behavior, set the handler for the onAddChildComplete event before calling this method.

Examples

The following JScript example uses the AddChild method to add a newly created storage object (a contact) as a child of another storage object.

// Create a new storage object that is a contact and set
// its data properties.
var contact = storage.CreateNewObject("Vcard2");
contact.ContactDisplayName = "Bob";
contact.ContactMobilePhone = "(206)555-1234";

// Add the new contact storage object as a child of the 
// main storage object.
storage.AddChild(contact); 

// Also add the contact as a child of another storage object within
// the main storage. Doing both will result in two separate new
// contact storage objects.
folder.AddChild(contact);

Requirements

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

See also

Creation Container Object

Storage Object

WPDObject