コード例 #1
0
 /// <inheritdoc />
 public abstract Task <RemoteDocumentTarget> ExecuteAsync(IDocument source, RemoteMissingTarget destination, CancellationToken cancellationToken);
        /// <inheritdoc />
        public override async Task <RemoteDocumentTarget> ExecuteAsync(IDocument source, RemoteMissingTarget destination, CancellationToken cancellationToken)
        {
            using (var stream = await source.OpenReadAsync(cancellationToken))
            {
                var content = new StreamContent(stream);
                using (var response = await Client
                                      .PutAsync(destination.DestinationUrl, content, cancellationToken)
                       )
                {
                    response.EnsureSuccessStatusCode();
                }
            }

            return(new RemoteDocumentTarget(destination.Parent, destination.Name, destination.DestinationUrl, this));
        }