System.Shell.Item.invokeVerb method

[ The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Invokes a verb associated with the item.

Syntax

System.Shell.Item.invokeVerb(
  [ strVerb ]
)

Parameters

strVerb [in, optional]

String that specifies a verb.

Note

The default verb is typically "open".

Return value

This method does not return a value.

Remarks

A verb is a string used to specify a particular action that an item supports. Invoking a verb is equivalent to selecting a command from an item's shortcut menu. Typically, invoking a verb launches a related application. For example, invoking the "open" verb on a .txt file opens the file with a text editor, usually Microsoft Notepad.

Examples

The following example demonstrates how to invoke the "Properties" verb on an item, if requested.

// --------------------------------------------------------------------
// Display the name of an object obtained from the UNC path and invoke
// an associated verb if requested.
// itemPath: the UNC path for the item.
// --------------------------------------------------------------------
function GetItemFromPath(itemPath)
{
    var oItem = System.Shell.itemFromPath(itemPath);
    // invoke: checkbox that indicates whether to invoke the verb.
    if (invoke.checked)
    {
        // Right-click and select from the list of available verbs 
        // for the item of interest.
        oItem.invokeVerb("Properties");
    }
    spFeedback.innerHTML = oItem.name + "<br/>";
}

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
Header
Shldisp.h
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)