IKnownFolder::SetPath method

Assigns a new path to a known folder.

Syntax


HRESULT SetPath(
  [in]  DWORD dwFlags,
  [in]  LPCWSTR pszPath
);

Parameters

dwFlags [in]

Type: DWORD

Either zero or the following value:

KF_FLAG_DONT_UNEXPAND

Set the full path without environment strings. If this flag is not set, portions of the path at pszPath may be represented by environment strings such as %USERPROFILE%.

pszPath [in]

Type: LPCWSTR

Pointer to the folder's new path. This is a null-terminated Unicode string of length MAX_PATH. This path cannot be of zero length. If this value is NULL, the IKnownFolder::SetPath sets the path to the default value.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method cannot be called on folders of type KF_CATEGORY_FIXED or KF_CATEGORY_VIRTUAL.

To call this method on a folder of type KF_CATEGORY_COMMON, the calling application must be running with elevated privileges.

This method is equivalent to SHSetKnownFolderPath.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Shobjidl.h

IDL

Shobjidl.idl

DLL

Shell32.dll

See also

IKnownFolder
SHSetKnownFolderPath
Known Folders Sample

 

 

Community Additions

ADD
Show:
© 2014 Microsoft