Media.getItemInfo method

The getItemInfo method retrieves the value of the specified attribute for the current media item.


strRetVal = Media.getItemInfo(


name [in]

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

Return value

This method returns a String representing the value of the specified attribute. For attributes whose underlying value is Boolean, it returns the string "true" or "false".


This method retrieves the metadata for an individual digital media item or a media item that is part of a playlist.

The attributeCount property contains the number of attribute names available for a given Media object. Index numbers can then be used with the getAttributeName method to determine the name of each available attribute. Individual attribute names can be passed to getItemInfo.

To retrieve attributes with multiple values and attributes with complex values, use the getItemInfoByType method.

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

To share the Windows media libraries over UPnP, Windows Media Player creates a content directory service (CDS) that is exposed over UPnP. Other devices can then navigate and browse the libraries.

In Windows 7, an application can use the Windows Media Player TrackingID and MediaType attributes to construct the object ID of each item in the CDS. Note that this construction might change in future versions of Windows. The application passes each of these attribute strings in the name parameter in a call to getItemInfo. getItemInfo returns the value for each attribute in the return value. The application then uses the following syntax to construct each object ID:


This syntax has the following meaning:

  • TrackingID is the string that is stored in the Windows Media Player TrackingID attribute of the media item.

  • MediaTypeID depends on the value of the MediaType attribute, as shown in the following table:

    MediaType attribute MediaTypeID
    Audio Items 4
    Photo Items B
    Video Items 8

Windows Media Player 10 Mobile: Attributes for a media item are available only during playback unless they are retrieved from the item through the media collection.


Windows Media Player version 7.0 or later.

See also

Media Object





Reading Attribute Values