IKnownFolderManager::UnregisterFolder method (shobjidl_core.h)

Remove a known folder from the registry, which makes it unknown to the known folder system. This method does not remove the folder itself.

Syntax

HRESULT UnregisterFolder(
  [in] REFKNOWNFOLDERID rfid
);

Parameters

[in] rfid

Type: REFKNOWNFOLDERID

GUID or KNOWNFOLDERID that represents the known 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 known to the current system.

Remarks

Note  This method updates HKEY_LOCAL_MACHINE and needs to be run in the context of an administrator. Setup programs need administrator privileges to register or unregister a known folder.
 

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

IKnownFolderManager::RegisterFolder

Known Folders Sample