Service.AddChild method
The AddChild method adds a WPDObject obtained from the Service.CreateNewObject method, as a child of this Service object.
Syntax
Service.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 Service 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 service object (a WMA ringtone) as a child of another service object.
// Get a WMA ringtone from a vendor.
var request = new ActiveXObject("MSXML2.XMLHTTP.3.0");
request.open("GET", "https://vendor/site/ringtone.wma", false);
request.send();
// Create a new service object. Set its title, and set its data to
// the WMA ringtone.
var ringtone = ringtoneService.CreateNewObject("Wma");
ringtone.MediaTitle = "blues";
ringtone.Data = request.responseStream;
// Add the new service object as a child of the ringtoneService object.
ringtoneService.AddChild(ringtone);
// Also add the new object as a child of another object within the
// service. Doing both will result in two separate new service objects
// containing the same WMA ringtone.
ringtoneFolder.AddChild(ringtone);
Requirements
Minimum supported client |
Windows 7 [desktop apps only] |
Minimum supported server |
Windows Server 2008 R2 [desktop apps only] |