Service.RemoveChild method

The RemoveChild method deletes a child object from this Service object.

Syntax

Service.RemoveChild(
  wpdObject,
  [ boolRecursive ]
)

Parameters

wpdObject

A WPDObject that is the child object to be deleted. If the child object does not exist, this method returns an error.

boolRecursive [optional]

A Boolean value that indicates whether the delete operation is recursive. If the child object to be removed contains children, this parameter must be set or the method will fail. If the boolRecursive parameter is not specified, and the child object does not contain children, the default value of "false" is assumed, and a non-recursive delete is performed.

Return value

This method does not return a value.

Remarks

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

Examples

The following JScript example demonstrates the different ways in which the RemoveChild method can be used.

// Removes someContact nonrecursively.
contactsService.RemoveChild(someContact, false);

// Also removes someContact nonrecursively, but if someContact has
// children, this method will fail. 
contactsService.RemoveChild(someContact);
    
// Removes someContact and all of the children in it. 
contactsService.RemoveChild(someContact, true);

Requirements

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

See also

Service Object

WPDObject