IKnownFolderManager::GetFolder method (shobjidl_core.h)

Gets an object that represents a known folder identified by its KNOWNFOLDERID. The object allows you to query certain folder properties, get the current path of the folder, redirect the folder to another location, and get the path of the folder as an ITEMIDLIST.

Syntax

HRESULT GetFolder(
  [in]  REFKNOWNFOLDERID rfid,
  [out] IKnownFolder     **ppkf
);

Parameters

[in] rfid

Type: REFKNOWNFOLDERID

Reference to the KNOWNFOLDERID.

[out] ppkf

Type: IKnownFolder**

When this method returns, contains an interface pointer to the IKnownFolder object that represents the folder.

Return value

Type: HRESULT

Returns S_OK if successful, or an error value otherwise, including the following:

Return code Description
E_INVALIDARG
Among other things, this value can indicate that the rfid parameter references a KNOWNFOLDERID that is not present on the system. Not all KNOWNFOLDERID values are present on all systems. Use IKnownFolderManager::GetFolderIds to retrieve the set of KNOWNFOLDERID values for the current system.

Remarks

To call this method, the caller must have at least User privileges.

When to Use

Use this method when you know exactly which known folder you are looking for and want to access it directly.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)
DLL Shell32.dll

See also

IKnownFolderManager

Known Folders Sample