MediaCollection.setDeleted 方法
[與此頁面相關聯的功能Windows 媒體播放機 SDK是舊版功能。 它已被 MediaPlayer 取代。 MediaPlayer已針對Windows 10和Windows 11進行優化。 Microsoft 強烈建議新程式碼盡可能使用MediaPlayer,而不是Windows 媒體播放機 SDK。 Microsoft 建議盡可能重寫使用舊版 API 的現有程式碼,以使用新的 API。]
setDeleted方法會將指定的媒體專案移至已刪除的專案資料夾。
語法
MediaCollection.setDeleted(
item,
true
)
參數
-
專案 [in]
-
正在移動的媒體 物件。
-
true [in]
-
請一律指定此值。
傳回值
這個方法不會傳回值。
備註
這個方法不會從使用者的電腦上移除檔案。
若要使用這個方法,需要程式庫的完整存取權。 如需詳細資訊,請參閱 程式庫存取。
Windows 媒體播放機 10 行動裝置版:不支援此方法。
範例
下列 JScript 範例使用 MediaCollection。setDeleted 將儲存在名為 mediaObject 之變數中的特定媒體專案移至已刪除的專案資料夾。 MediaCollection。isDeleted方法會先測試是否已刪除專案。 Player物件是以 ID = 「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 |
|
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應