Share via


IWMPPlaylistCollection::newPlaylist 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 newPlaylist method returns an IWMPPlaylist interface for a new, empty playlist in the library.

Syntax

public IWMPPlaylist newPlaylist(
  System.String bstrName
);

Public Function newPlaylist( _
  ByVal bstrName As System.String _
) As IWMPPlaylist
Implements IWMPPlaylistCollection.newPlaylist

Parameters

bstrName [in]

A System.String that is the name of the new playlist.

Return value

A WMPLib.IWMPPlaylist interface for the new playlist.

Remarks

This method creates an empty playlist in the library. To fill the playlist with media items, use IWMPPlaylist.appendItem or IWMPPlaylist.insertItem.

Multiple playlists having the same name are permitted in the library. To avoid creating a duplicate playlist name with this method, use the getByName method and IWMPPlaylistArray.count to discover whether a playlist with a particular name already exists.

Leading and trailing spaces are not permitted in playlist names, and are automatically removed from the value specified for the bstrName parameter.

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

Examples

The following example creates a new empty playlist called "ThreeList", adds it to the playlist collection, and returns an interface to it. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Add a new empty playlist, named ThreeList, to the playlist collection.
WMPLib.IWMPPlaylist newList = player.playlistCollection.newPlaylist("ThreeList");

'  Add a new empty playlist, named ThreeList, to the playlist collection.
Dim newList As WMPLib.IWMPPlaylist = player.playlistCollection.newPlaylist("ThreeList")

Requirements

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

See also

IWMPPlaylist Interface (VB and C#)

IWMPPlaylist.appendItem (VB and C#)

IWMPPlaylist.insertItem (VB and C#)

IWMPPlaylistArray.count (VB and C#)

IWMPPlaylistCollection Interface (VB and C#)

IWMPPlaylistCollection.getByName (VB and C#)