IFileOperation::MoveItem method (shobjidl_core.h)

Declares a single item that is to be moved to a specified destination.

Syntax

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

Parameters

[in] psiItem

Type: IShellItem*

Pointer to an IShellItem that specifies the source item.

[in] psiDestinationFolder

Type: IShellItem*

Pointer to an IShellItem that specifies the destination folder to contain the moved item.

[in] pszNewName

Type: LPCWSTR

Pointer to a new name for the item in its new location. This is a null-terminated Unicode string and can be NULL. If NULL, the name of the destination item is the same as the source.

[in] pfopsItem

Type: IFileOperationProgressSink*

Pointer to an IFileOperationProgressSink object to be used for progress status and error notifications for this specific move operation. If you call IFileOperation::Advise for the overall operation, progress status and error notifications for the move 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 move the item, it merely declares the item to be moved. To move an object, you must make at least the sequence of calls detailed here:

  1. Call IFileOperation::MoveItem to declare the source item, destination folder, and destination name.
  2. Call IFileOperation::PerformOperations to begin the move 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::MoveItems

PostMoveItem

PreMoveItem