IFileOperation::RenameItem method (shobjidl_core.h)

Declares a single item that is to be given a new display name.

Syntax

HRESULT RenameItem(
  [in] IShellItem                 *psiItem,
  [in] LPCWSTR                    pszNewName,
  [in] IFileOperationProgressSink *pfopsItem
);

Parameters

[in] psiItem

Type: IShellItem*

Pointer to an IShellItem that specifies the source item.

[in] pszNewName

Type: LPCWSTR

Pointer to the new display name of the item. This is a null-terminated, Unicode string.

[in] pfopsItem

Type: IFileOperationProgressSink*

Pointer to an IFileOperationProgressSink object to be used for status and failure notifications. If you call IFileOperation::Advise for the overall operation, progress status and error notifications for the rename operation are included there, so set this parameter to NULL.

Return value

Type: HRESULT

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

Remarks

This method does not rename the item, it merely declares the item to be renamed. To rename an object, you must make at least the sequence of calls detailed here:

  1. Call IFileOperation::RenameItem to declare the new name.
  2. Call IFileOperation::PerformOperations to begin the rename operation.

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)

See also

IFileOperation

IFileOperation::RenameItems

PostRenameItem

PreRenameItem