Windows Media Player 11 SDK MediaCollection.getByAttribute 

Windows Media Player SDK banner art

Previous Next

MediaCollection.getByAttribute

The getByAttribute method retrieves a playlist of media items that contain a specified value for a specified attribute.

Syntax

  

Parameters

attribute

String indicating the name of the attribute to search. For information about the attributes supported by Windows Media Player, see the Windows Media Player Attribute Reference.

value

String indicating the value that the attribute should have.

Return Values

This method returns a Playlist object.

Remarks

This method can be used to create a generic query for media items that match a value for an attribute in the database. This is useful in the case of user-defined attributes. If the attribute does not exist, an error will result.

You can use this method to retrieve all of the media items of a specific type. Use the attribute name "MediaType" and one of the following values:

Value Description
audio Music and other audio-only items.
playlist Playlists represented as Media objects.
radio Radio station items. Not used by Windows Media Player 10.
video Video items.
photo Photo items. Requires Windows Media Player 10.
other Other items, such as ASF files or URLs to streaming media.

To use this method, read access to the library is required. For more information, see Library Access.

Example Code

The following JScript example uses MediaCollection.getByAttribute to play all content from the library by the artist named Triode 48. The Player object was created with ID = "Player".

  

Requirements

Version: Windows Media Player version 7.0 or later.

Library: Use wmp.dll.

See Also

Previous Next