System.Shell.Item.SHFolder property

[ 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. ]

Gets a System.Shell.Folder object from the System.Shell.Item.

This property is read-only.

Syntax


objSHFolder = System.Shell.Item.SHFolder


Property value

System.Shell.Folder that represents the System.Shell.Item.

Remarks

Useful for performing folder operations on a System.Shell.Item object that represents a system folder.

SHFolder does not get the parent folder of a System.Shell.Item that represents a file or link.

Examples

The following example demonstrates how to select a location, get a System.Shell.Folder object and create a new folder at that location.


// Member variables.
var oShellFolderItem;
var oShellFolder;

// --------------------------------------------------------------------
// Display the folder picker dialog and get a Shell.Item object 
// from the selection. A Shell folder object is also obtained.
// --------------------------------------------------------------------
function ChooseAFolder()
{
    oShellFolderItem = System.Shell.chooseFolder("SDK Choose Folder Example", 0);
    if (oShellFolderItem)
    {
        spFeedback.innerHTML = oShellFolderItem.name + "<br/>";
        // Get a folder object from the System.Shell.Item.
        oShellFolder = oShellFolderItem.SHFolder;
    }
}

// --------------------------------------------------------------------
// Create a new folder.
// folderName: the user specified folder name.
// --------------------------------------------------------------------
function CreateFolder(folderName)
{
    if (folderName)
    {
        if (oShellFolder)
        {
            try
            {
                oShellFolder.newFolder(folderName);
                spFolderFeedback.innerHTML = oShellFolderItem.name + " folder created.<br/>";
            }
            catch (e)
            {
                spFolderFeedback.innerHTML = e.description ;
                // Error handling.
            }
        }
        else
        {
            spFolderFeedback.innerHTML = "Unable to create folder. No location specified.<br/>Please select a parent folder.<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

IDL

Sidebar.idl

DLL

Sidebar.Exe (version 1.00 or later)

 

 

Community Additions

ADD
Show: