System.Shell.knownFolderPath Method

Retrieves a Known Folder Universal Naming Convention (UNC) path.

Syntax

strKnownFolderPath = System.Shell.knownFolderPath(
  strKnownFolderID
)

Parameters

  • strKnownFolderID [in]
    BSTR Sets String that specifies the Known Folder ID. Note  For Windows 7, this method can accept a KNOWNFOLDERID globally unique identifier (GUID).
  • strKnownFolderPath [out]
    String Sets String that specifies the UNC path.

Remarks

strKnownFolderID represents the GUID that identifies standard folders registered with the system as Known Folders. These folders are installed with Windows Vista and later operating systems; a computer will only have the folders appropriate to it installed.

The following are valid well-known folder names:

  • Desktop
  • Startup
  • StartMenu
  • Documents
  • Programs
  • CommonStartup
  • CommonPrograms
  • PublicDesktop
  • PublicFavorites
  • PublicDocuments
  • System
  • SystemX86
  • Profile
  • Windows
  • Pictures
  • Music
  • Videos
  • ProgramFiles
  • ProgramFilesCommon
  • ProgramFilesX86
  • ProgramFilesCommonX86
  • AdminTools
  • CommonAdminTools
  • PublicMusic
  • PublicPictures
  • PublicVideos
  • UserProfiles
  • Downloads
  • PublicDownloads
  • GadgetsUser
  • RecycleBinFolder

Note   Well-known names can vary across operating systems.

Examples

The following example demonstrates how to retrieve the UNC path for a known folder.

// --------------------------------------------------------------------
// Display the UNC path of the Known Folder.
// txtKnownFolderID: the Known Folder GUID.
// --------------------------------------------------------------------
function GetKnownFolderPath(txtKnownFolderID)
{
    try
    {
        spFeedback.innerHTML = System.Shell.knownFolderPath(txtKnownFolderID) + "<br/>";
    }
    catch(e)
    {
        spFeedback.innerHTML = "Unable to retrieve path.<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