System.Shell.RecycleBin.deleteItem Method
Deletes an item from the system by moving it to the Recycle Bin.
Syntax
retVal = System.Shell.RecycleBin.deleteItem(
strItemToDelete
)
Parameters
- strItemToDelete [in]
BSTR Sets String that specifies the item to delete.
Remarks
The Recycle Bin Properties settings determine how file deletion is handled. For example, whether files are deleted immediately or stored until the Recycle Bin is emptied, whether the Recycle Bin is system-wide or operates on a per-drive basis, and whether confirmation dialogs are displayed.
Examples
The following example demonstrates how to delete objects from the system.
// --------------------------------------------------------------------
// Display the names of objects dropped on the gadget.
// Objects are deleted as required.
// --------------------------------------------------------------------
function GetItemFromDrop()
{
spFeedback.innerHTML = "Item(s) dropped.<br/>";
var intIndex = 0;
var oItem;
var sItem = "Other:";
while(oItem = System.Shell.itemFromFileDrop(event.dataTransfer, intIndex))
{
// Display object properties and increment the index.
if (oItem.isFileSystem == true)
{
sItem = "File: ";
}
if (oItem.isFolder == true)
{
sItem = "Folder: ";
}
if (oItem.isLink == true)
{
sItem = "Link: ";
}
spFeedback.innerHTML += sItem;
spFeedback.innerHTML += oItem.name + "<br/>";
// Delete object as required.
if (deleteDrop.checked == true)
{
System.Shell.RecycleBin.deleteItem(oItem.path);
spFeedback.innerHTML += "Item deleted.<br/>";
}
intIndex++;
}
System.Shell.refreshDesktop();
}
Requirements
| Minimum supported client | Windows Vista |
| Minimum supported server | Windows Server 2008 |
| IDL | Sidebar.idl |
| DLL | Sidebar.Exe version 1.00 or later |
See Also
Send comments about this topic to Microsoft
Build date: 2/24/2010
Build type: SDK