System.Shell.Item.invokeVerb Method

Invokes a verb associated with the item.

Syntax

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

Parameters

  • strVerb [in, optional]
    BSTR Sets 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
Minimum supported server Windows Server 2008
DLL Sidebar.Exe version 1.00 or later

See Also

System.Shell.Item

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK