Share via


Service.GetChildrenByFormat method

The GetChildrenByFormat method returns a collection of the immediate children of this Service object filtered by one or more object formats.

Syntax

retVal = Service.GetChildrenByFormat(
  FormatList
)

Parameters

FormatList

VARIANT that can be a string containing the name of one format, or an array of strings containing several formats. An individual format name can be a WPD-defined format, a service-defined format, or a string representation of a format GUID, for example "{aaaaaaaa-bbbb-cccc-dddd-eeeeeeffffff}".

Return value

Returns a childrenCollection that contains all of the immediate children of this Service object that have been formatted with one of the object formats in the specified format list.

Remarks

This method might take a while to complete on slower devices, or devices with a lot of content.

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

Examples

The following JScript example uses the GetChildrenByFormat method to retrieve a childrenCollection of all the Windows Media Audio (WMA) and MP3 formatted ringtones in the ringtoneService object.

var children = ringtonesService.GetChildrenByFormat(["Wma", "Mp3"]);

The following JScript example demonstrates the different ways in which the VARIANT parameter FormatList can be expressed. This parameter can contain one or more WPD-defined or service format names.

// A string.
var children = service.GetChildrenByFormat("AbstractContact");

// An array of strings.
var children = service.GetChildrenByFormat(["AbstractContact", "Vcard2"]);

// An array of strings in a JScript Array object.
var formats = new Array("AbstractContact", "Vcard2"); 
var children = service.GetChildrenByFormat(formats);

// A string representation of the format GUID. 
var children = service.GetChildrenByFormat("{aaaaaaaa-bbbb-cccc-dddd-eeeeeeffffff}");

Requirements

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

See also

childrenCollection Object

Service Object