IFileOperation::MoveItem method

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

Syntax


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

Parameters

psiItem [in]

Type: IShellItem*

Pointer to an IShellItem that specifies the source item.

psiDestinationFolder [in]

Type: IShellItem*

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

pszNewName [in]

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.

pfopsItem [in]

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

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::MoveItems
PreMoveItem
PostMoveItem

 

 

Show: