Share via


MediaCollection.getPlaylistByQuery method

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The getPlaylistByQuery method retrieves a Playlist object containing Media objects that match the query conditions.

Syntax

retVal = MediaCollection.getPlaylistByQuery(
  query,
  mediaType,
  sortAttribute,
  sortAscending
)

Parameters

query [in]

Query object that defines the conditions used to create the playlist.

mediaType [in]

String containing the media type. Must contain one of the following values: "audio", "video", "photo", "playlist", or "other".

sortAttribute [in]

String containing the attribute name used for sorting. An empty string ("") means no sorting is applied.

sortAscending [in]

Boolean, true indicating that the playlist must be sorted in ascending order.

Return value

This method returns a Playlist object.

Remarks

Compound queries using Query are not case sensitive.

When the compound query specified by the query parameter contains a condition built on the MediaType attribute, that condition is ignored. The value for the mediaType parameter is always used. For example, if the compound query contains the condition "MediaType Equals audio" and the value for the mediaType parameter is "video", the resulting playlist will contain only video items.

Requirements

Requirement Value
Version
Windows Media Player 11.
DLL
Wmp.dll

See also

MediaCollection Object

MediaType Attribute

Query Object