Storage.GetChildrenByFormat method

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

Syntax

retVal = Storage.GetChildrenByFormat(
  FormatList
)

Parameters

FormatList

A 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, such as "{aaaaaaaa-bbbb-cccc-dddd-eeeeeeffffff}".

Return value

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

Remarks

This method may 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 "WMA" and "MP3" formatted objects in the storage object.

var storage = deviceObject.Storages[0];        
var childrenCollection = storage.GetChildrenByFormat(["Wma", "Mp3"]);

This JScript example demonstrates how the VARIANT parameter FormatList can be expressed. This parameter can contain one or more WPD-defined or service-defined format names.

// A string.
var children = storage.GetChildrenByFormat("Wma");

// An array of strings.
var children = storage.GetChildrenByFormat(["Wma", "Mp3"]);

// An array of strings in a JScript Array object.
var formats = new Array("Wma", "Mp3"); 
var children = storage.GetChildrenByFormat(formats);

// A string representation of the format GUID. 
var children = storage.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

Storage Object