MediaCollection.setDeleted 方法

[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 Microsoft 强烈建议新代码尽可能使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]

setDeleted 方法将指定的媒体项移动到已删除邮件文件夹。

语法

MediaCollection.setDeleted(
  item,
  true
)

参数

item [in]

正在移动的媒体对象。

true [in]

始终指定此值。

返回值

此方法不返回值。

备注

此方法不会从用户的计算机中删除文件。

若要使用此方法,需要对库的完全访问权限。 有关详细信息,请参阅 库访问

Windows 媒体播放器 10 移动版:不支持此方法。

示例

以下 JScript 示例使用 MediaCollectionsetDeleted 用于将存储在名为 mediaObject 的变量中的特定媒体项移动到已删除的项目文件夹。 MediaCollectionisDeleted 方法首先测试该项是否已删除。 创建 ID 为“Player”的 Player 对象。

// Test whether the media item is in the deleted items folder.
if (!Player.mediaCollection.isDeleted(mediaObject)){

    // The item is available to be deleted; move it to 
    // the deleted items folder.
    Player.mediaCollection.setDeleted(mediaObject, true);

    // Inform the user that the operation succeeded.
    alert("Item moved to deleted items folder.");}

else
    // Tell the user the operation is unnecessary.
    alert("Item is already deleted!");
}

要求

要求
版本
Windows 媒体播放器版本 7.0、Windows 媒体播放器版本 7.1 或 Windows XP Windows 媒体播放器。 Windows 媒体播放器 9 系列或更高版本不支持此方法。
DLL
Wmp.dll

另请参阅

Media 对象

MediaCollection 对象

MediaCollection.isDeleted

Settings.mediaAccessRights

Settings.requestMediaAccessRights