次の方法で共有


PlaylistCollection.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 creates a new playlist in the library.

Syntax

retVal = PlaylistCollection.newPlaylist(
  name
)

Parameters

name [in]

String containing the name of the playlist to be created.

Return value

This method returns a Playlist object.

Remarks

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

Multiple playlists having the same name are permitted in the library. To avoid creating a duplicate playlist name with this method, use getByName and PlaylistArray.count to determine 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 name parameter.

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

Examples

The following JScript example creates a new empty playlist called "ThreeList". The Player object was created with ID="Player".

//Add a new empty playlist, named ThreeList, to the playlist collection.
var NewList = Player.playlistCollection.newPlaylist("ThreeList");

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

MediaCollection.add

Playlist.appendItem

Playlist.insertItem

PlaylistArray.count

PlaylistCollection Object

PlaylistCollection.getByName

PlaylistCollection.importPlaylist

PlaylistCollection.remove

Settings.mediaAccessRights

Settings.requestMediaAccessRights