/// <summary> /// Copies a file or directory from a source location in the library to a target location. /// </summary> /// <param name="documentLibraryClient">The IDocumentLibraryClient instance.</param> /// <param name="libraryId">The library ID.</param> /// <param name="source">The path to the source file or directory.</param> /// <param name="target">The path to the target file or directory.</param> /// <param name="tenantId">Optional. Specifies which tenant to use.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>Success if there were no errors.</returns> public static async Task CopyAsync(this IDocumentLibraryClient documentLibraryClient, Guid libraryId, CloudPath source, CloudPath target, Guid?tenantId = null, CancellationToken cancellationToken = default) { if (documentLibraryClient is null) { throw new ArgumentNullException(nameof(documentLibraryClient)); } Result result = await documentLibraryClient.CopyResultAsync(libraryId, source, target, tenantId, cancellationToken).ConfigureAwait(false); if (result.IsSuccess) { return; } throw ApiException.Create(result.Error); }