IFileOperation::RenameItems method

Declares a set of items that are to be given a new display name. All items are given the same name.

Syntax


HRESULT RenameItems(
  [in]  IUnknown *pUnkItems,
  [in]  LPCWSTR pszNewName
);

Parameters

pUnkItems [in]

Type: IUnknown*

Pointer to the IUnknown of the IShellItemArray, IDataObject, or IEnumShellItems object which represents the group of items to be renamed. You can also point to an IPersistIDList object to represent a single item, effectively accomplishing the same function as IFileOperation::RenameItem.

pszNewName [in]

Type: LPCWSTR

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

Return value

Type: HRESULT

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

Remarks

If more than one of the items in the collection at pUnkItems is in the same folder, the renamed files are appended with a number in parentheses to differentiate them, for instance newfile(1).txt, newfile(2).txt, and newfile(3).txt.

This method does not rename the items, it merely declares the items to be renamed. To rename a group of objects, you must make at least the sequence of calls detailed here:

  1. Call IFileOperation::RenameItems to declare the source files or folders and 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::RenameItem

 

 

Community Additions

ADD
Show:
© 2014 Microsoft