共用方式為


IFileSystemProvider.MoveAsync Method

Definition

Moves or renames a file or directory.

public:
 System::Threading::Tasks::Task ^ MoveAsync(Uri ^ oldUri, Uri ^ newUri, bool overwrite, IProgress<Microsoft::VisualStudio::RpcContracts::FileSystem::OperationProgressData> ^ progress, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task MoveAsync (Uri oldUri, Uri newUri, bool overwrite, IProgress<Microsoft.VisualStudio.RpcContracts.FileSystem.OperationProgressData>? progress, System.Threading.CancellationToken cancellationToken);
abstract member MoveAsync : Uri * Uri * bool * IProgress<Microsoft.VisualStudio.RpcContracts.FileSystem.OperationProgressData> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function MoveAsync (oldUri As Uri, newUri As Uri, overwrite As Boolean, progress As IProgress(Of OperationProgressData), cancellationToken As CancellationToken) As Task

Parameters

oldUri
Uri

The existing file or directory.

newUri
Uri

The new location.

overwrite
Boolean

True to overwrite existing files; otherwise false.

progress
IProgress<OperationProgressData>

The interface through which progress is reported.

cancellationToken
CancellationToken

The cancellation token.

Returns

A task representing the asynchronous rename operation.

Exceptions

oldUri is null or newUri is null.

oldUri does not exist.

The parent of newUri does not exist.

newUri already exists and overwrite is false. ErrorCode will be set to FileAlreadyExists.

The caller does not have the required permission.

Applies to