IFileOperation::RenameItem method

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

Syntax


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

Parameters

psiItem [in]

Type: IShellItem*

Pointer to an IShellItem that specifies the source item.

pszNewName [in]

Type: LPCWSTR

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

pfopsItem [in]

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

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Shobjidl.h

IDL

Shobjidl.idl

See also

IFileOperation
IFileOperation::RenameItems
PreRenameItem
PostRenameItem

 

 

Show: