IKnownFolderManager::Redirect method (shobjidl_core.h)

Redirects folder requests for common and per-user folders.

Syntax

HRESULT Redirect(
  [in]           REFKNOWNFOLDERID    rfid,
  [in, optional] HWND                hwnd,
  [in]           KF_REDIRECT_FLAGS   flags,
  [in, optional] LPCWSTR             pszTargetPath,
  [in]           UINT                cFolders,
  [in]           const KNOWNFOLDERID *pExclusion,
  [out]          LPWSTR              *ppszError
);

Parameters

[in] rfid

Type: REFKNOWNFOLDERID

A reference to the KNOWNFOLDERID of the folder to be redirected.

[in, optional] hwnd

Type: HWND

The handle of the parent window used to display copy engine progress UI dialogs when KF_REDIRECT_WITH_UI is passed in the flags parameter. If no progress dialog is needed, this value can be NULL.

[in] flags

Type: KF_REDIRECT_FLAGS

The KF_REDIRECT_FLAGS options for redirection.

[in, optional] pszTargetPath

Type: LPCWSTR

A pointer to the new path for the folder. This is a null-terminated Unicode string. This value can be NULL.

[in] cFolders

Type: UINT

The number of KNOWNFOLDERID values in the array at pExclusion.

[in] pExclusion

Type: KNOWNFOLDERID const*

Pointer to an array of KNOWNFOLDERID values that refer to subfolders of rfid that should be excluded from the redirection. If no subfolders are excluded, this value can be NULL.

[out] ppszError

Type: LPWSTR*

When this method returns, contains the address of a pointer to a null-terminated Unicode string that contains an error message if one was generated. This value can be NULL.

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.

Requirements

   
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)

See also

IKnownFolderManager

Known Folders Sample