Share via


System.Shell.itemFromPath Method

Retrieves a System.Shell.Item that represents an object at the specified Universal Naming Convention (UNC) path.

Syntax

oShellItem = System.Shell.itemFromPath(
  strPath
)

Parameters

  • strPath [in]
    BSTR String that specifies the UNC path.
  • oShellItem [out]
    Object Sets System.Shell.Item that represents the object at the specified UNC location.

Return Value

HRESULT

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Examples

The following example demonstrates how to obtain a System.Shell.Item based on its UNC location.

// --------------------------------------------------------------------
// Display the name of an object obtained from the UNC path.
// --------------------------------------------------------------------
function GetItemFromPath()
{
    var oItem = System.Shell.itemFromPath(System.Gadget.path + "\\test.txt");
    spFeedback.innerHTML = oItem.name + "<br/>";
}

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

System.Shell

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK