Share via


IWMPPlaylist::appendItem 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 appendItem method adds a media item to the end of a playlist.

Syntax

public void appendItem(
  IWMPMedia pIWMPMedia
);

Public Sub appendItem( _
  ByVal pIWMPMedia As IWMPMedia _
)
Implements IWMPPlaylist.appendItem

Parameters

pIWMPMedia [in]

An WMPLib.IWMPMedia interface that represents the media item to be appended.

Return value

This method does not return a value.

Remarks

Before calling this method, you must have full access to the library. For more information, see Library Access.

Examples

The following example uses appendItem to add the current media item to the playlist named "ThreeList". The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Get an interface to the current media item.
WMPLib.IWMPMedia currMedia = player.currentMedia;

// Get an interface to the playlist named "ThreeList".
WMPLib.IWMPPlaylist plThreeList = player.playlistCollection.getByName("ThreeList").Item(0);

// Append the media item to the playlist.
plThreeList.appendItem(currMedia);

' Get an interface to the current media item.
Dim currMedia As WMPLib.IWMPMedia = player.currentMedia

' Get an interface to the playlist named "ThreeList".
Dim plThreeList As WMPLib.IWMPPlaylist = player.playlistCollection.getByName("ThreeList").Item(0)

' Append the media item to the playlist.
plThreeList.appendItem(currMedia)

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPMedia Interface (VB and C#)

IWMPPlaylist Interface (VB and C#)