<PackageReference Include="Microsoft.Azure.Storage.File" Version="11.1.3" />

Microsoft.Azure.Storage.File.CloudFile

public class CloudFile : IListFileItem
Represents a Microsoft Azure File.
public CopyState CopyState { get; }

Gets the state of the most recent or pending copy operation.

public string FilePermission { get; set; }

The file permission to set on the next File Create or Set Properties call. This field will be null after File.Create, File.SetProperties, File.GetProperties, and File.Get calls.

public IDictionary<string, string> Metadata { get; }

Gets the user-defined metadata for the file.

public virtual string Name { get; }

Gets the file's name.

public CloudFileDirectory Parent { get; }

Gets the CloudFileDirectory object representing the parent directory for the file.

public virtual FileProperties Properties { get; }

Gets the file's system properties.

Gets the CloudFileClient object that represents the File service.

public CloudFileShare Share { get; }

Gets a CloudFileShare object representing the file's share.

public StorageUri SnapshotQualifiedStorageUri { get; }

Gets the file's URI for both the primary and secondary locations, including query string information if the file's share is a snapshot.

public Uri SnapshotQualifiedUri { get; }

Gets the absolute URI to the file, including query string information if the file's share is a snapshot.

public StorageUri StorageUri { get; }

Gets the absolute URI to the file.

public int StreamMinimumReadSizeInBytes { get; set; }

Gets or sets the minimum number of bytes to buffer when reading from a file stream.

public int StreamWriteSizeInBytes { get; set; }

Gets or sets the number of bytes to buffer when writing to a file stream.

public Uri Uri { get; }

Gets the file's URI.

public CloudFile(Uri fileAbsoluteUri)

Initializes a new instance of the CloudFile class using an absolute URI to the file.

public CloudFile(Uri fileAbsoluteUri, StorageCredentials credentials)

Initializes a new instance of the CloudFile class using an absolute URI to the file.

public CloudFile(StorageUri fileAbsoluteUri, StorageCredentials credentials)

Initializes a new instance of the CloudFile class using an absolute URI to the file.

public virtual Task AbortCopyAsync(string copyId)

Aborts an ongoing copy operation.

public virtual Task AbortCopyAsync(string copyId, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Aborts an ongoing copy operation.

public virtual Task AbortCopyAsync(string copyId, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Aborts an ongoing copy operation.

public virtual Task ClearRangeAsync(long startOffset, long length)

Clears ranges from a file.

public virtual Task ClearRangeAsync(long startOffset, long length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Clears ranges from a file.

public virtual Task ClearRangeAsync(long startOffset, long length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Clears ranges from a file.

public virtual Task<CloseFileHandleResultSegment> CloseAllHandlesSegmentedAsync(FileContinuationToken token = null, AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = default)

Returns a task that performs an asynchronous operation to close all SMB handles on this file.

public virtual Task<CloseFileHandleResultSegment> CloseHandleSegmentedAsync(string handleId, FileContinuationToken token = null, AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = default)

Returns a task that performs an asynchronous operation to close the specified SMB handle on this file.

public virtual Task CreateAsync(long size)

Creates a file. If the file already exists, it will be overwritten.

public virtual Task CreateAsync(long size, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Creates a file. If the file already exists, it will be overwritten.

public virtual Task CreateAsync(long size, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Creates a file. If the file already exists, it will be overwritten.

public virtual Task DeleteAsync()

Deletes the file.

public virtual Task DeleteAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Deletes the file.

public virtual Task DeleteAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Deletes the file.

public virtual Task<bool> DeleteIfExistsAsync()

Deletes the file if it already exists.

public virtual Task<bool> DeleteIfExistsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Deletes the file if it already exists.

public virtual Task<bool> DeleteIfExistsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Deletes the file if it already exists.

public virtual Task<int> DownloadRangeToByteArrayAsync(byte[] target, int index, long? fileOffset, long? length)

Downloads the contents of a file to a byte array.

public virtual Task<int> DownloadRangeToByteArrayAsync(byte[] target, int index, long? fileOffset, long? length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Downloads the contents of a file to a byte array.

public virtual Task<int> DownloadRangeToByteArrayAsync(byte[] target, int index, long? fileOffset, long? length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the contents of a file to a byte array.

public virtual Task<int> DownloadRangeToByteArrayAsync(byte[] target, int index, long? fileOffset, long? length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the contents of a file to a byte array.

public virtual Task DownloadRangeToStreamAsync(Stream target, long? offset, long? length)

Downloads the contents of a file to a stream.

public virtual Task DownloadRangeToStreamAsync(Stream target, long? offset, long? length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Downloads the contents of a file to a stream.

public virtual Task DownloadRangeToStreamAsync(Stream target, long? offset, long? length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the contents of a file to a stream.

public virtual Task DownloadRangeToStreamAsync(Stream target, long? offset, long? length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the contents of a file to a stream.

public virtual Task<string> DownloadTextAsync()

Downloads the file's contents as a string.

public virtual Task<string> DownloadTextAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Downloads the file's contents as a string.

public virtual Task<string> DownloadTextAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the file's contents as a string.

public virtual Task<string> DownloadTextAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the file's contents as a string.

public virtual Task<int> DownloadToByteArrayAsync(byte[] target, int index)

Downloads the contents of a file to a byte array.

public virtual Task<int> DownloadToByteArrayAsync(byte[] target, int index, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Downloads the contents of a file to a byte array.

public virtual Task<int> DownloadToByteArrayAsync(byte[] target, int index, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the contents of a file to a byte array.

public virtual Task<int> DownloadToByteArrayAsync(byte[] target, int index, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the contents of a file to a byte array.

public virtual Task DownloadToFileAsync(string path, FileMode mode)

public virtual Task DownloadToFileAsync(string path, FileMode mode, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

public virtual Task DownloadToFileAsync(string path, FileMode mode, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the contents of a file to a file.

public virtual Task DownloadToFileAsync(string path, FileMode mode, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the contents of a file to a file.

public virtual Task DownloadToStreamAsync(Stream target)

Downloads the contents of a file to a stream.

public virtual Task DownloadToStreamAsync(Stream target, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Downloads the contents of a file to a stream.

public virtual Task DownloadToStreamAsync(Stream target, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Downloads the contents of a file to a stream.

public virtual Task DownloadToStreamAsync(Stream target, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Downloads the contents of a file to a stream.

public virtual Task<bool> ExistsAsync()

Checks existence of the file.

public virtual Task<bool> ExistsAsync(FileRequestOptions options, OperationContext operationContext)

Checks existence of the file.

public virtual Task<bool> ExistsAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Checks existence of the file.

public virtual Task FetchAttributesAsync()

Populates a file's properties and metadata.

public virtual Task FetchAttributesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Populates a file's properties and metadata.

public virtual Task FetchAttributesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Populates a file's properties and metadata.

Returns a shared access signature for the file.

public string GetSharedAccessSignature(SharedAccessFilePolicy policy, string groupPolicyIdentifier)

Returns a shared access signature for the file.

Returns a shared access signature for the file.

public string GetSharedAccessSignature(SharedAccessFilePolicy policy, SharedAccessFileHeaders headers, string groupPolicyIdentifier)

Returns a shared access signature for the file.

public string GetSharedAccessSignature(SharedAccessFilePolicy policy, SharedAccessFileHeaders headers, string groupPolicyIdentifier, SharedAccessProtocol? protocols, IPAddressOrRange ipAddressOrRange)

Returns a shared access signature for the file.

public virtual Task<FileHandleResultSegment> ListHandlesSegmentedAsync(FileContinuationToken token = null, int? maxResults = default, AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = default)

Returns a task that performs an asynchronous operation to get the SMB handles open on this file.

public virtual Task<IEnumerable<FileRange>> ListRangesAsync(long? offset, long? length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Gets a collection of valid ranges and their starting and ending bytes.

public virtual Task<IEnumerable<FileRange>> ListRangesAsync(long? offset, long? length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Gets a collection of valid ranges and their starting and ending bytes.

public virtual Task<Stream> OpenReadAsync()

Opens a stream for reading from the file.

public virtual Task<Stream> OpenReadAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Opens a stream for reading from the file.

public virtual Task<Stream> OpenReadAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Opens a stream for reading from the file.

public virtual Task<CloudFileStream> OpenWriteAsync(long? size)

Opens a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.

public virtual Task<CloudFileStream> OpenWriteAsync(long? size, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Opens a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.

public virtual Task<CloudFileStream> OpenWriteAsync(long? size, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Opens a stream for writing to the file.

public virtual Task ResizeAsync(long size)

Resizes a file.

public virtual Task ResizeAsync(long size, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Resizes a file.

public virtual Task ResizeAsync(long size, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Resizes a file.

public virtual Task SetMetadataAsync()

Updates the file's metadata.

public virtual Task SetMetadataAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Updates the file's metadata.

public virtual Task SetMetadataAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Updates the file's metadata.

public virtual Task SetPropertiesAsync()

Updates the file's properties.

public virtual Task SetPropertiesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Updates the file's properties.

public virtual Task SetPropertiesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Updates the file's properties.

public virtual Task<string> StartCopyAsync(Uri source)

Begins an operation to start copying an existing blob or Azure file's contents, properties, and metadata to a new Azure file.

public virtual Task<string> StartCopyAsync(CloudFile source)

Begins an operation to start copying an existing Azure file's contents, properties, and metadata to a new Azure file.

public virtual Task<string> StartCopyAsync(Uri source, AccessCondition sourceAccessCondition, AccessCondition destAccessCondition, FileRequestOptions options, OperationContext operationContext)

Begins an operation to start copying a blob or file's contents, properties, and metadata to a new Azure file.

public virtual Task<string> StartCopyAsync(Uri source, AccessCondition sourceAccessCondition, AccessCondition destAccessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Begins an operation to start copying a blob or file's contents, properties, and metadata to a new Azure file.

public virtual Task UploadFromByteArrayAsync(byte[] buffer, int index, int count)

Uploads the contents of a byte array to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadFromByteArrayAsync(byte[] buffer, int index, int count, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Uploads the contents of a byte array to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadFromByteArrayAsync(byte[] buffer, int index, int count, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Uploads the contents of a byte array to a file.

public virtual Task UploadFromByteArrayAsync(byte[] buffer, int index, int count, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Uploads the contents of a byte array to a file.

public virtual Task UploadFromFileAsync(string path)

public virtual Task UploadFromFileAsync(string path, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

public virtual Task UploadFromFileAsync(string path, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Uploads a file to the Azure File Service. If the file already exists on the service, it will be overwritten.

public virtual Task UploadFromFileAsync(string path, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Uploads a file to the Azure File Service. If the file already exists on the service, it will be overwritten.

public virtual Task UploadFromStreamAsync(Stream source)

Uploads a stream to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadFromStreamAsync(Stream source, long length)

Uploads a stream to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadFromStreamAsync(Stream source, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Uploads a stream to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadFromStreamAsync(Stream source, long length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Uploads a stream to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadFromStreamAsync(Stream source, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Uploads a stream to a file.

public virtual Task UploadFromStreamAsync(Stream source, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Uploads a stream to a file.

public virtual Task UploadFromStreamAsync(Stream source, long length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Uploads a stream to a file.

public virtual Task UploadFromStreamAsync(Stream source, long length, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Uploads a stream to a file.

public virtual Task UploadTextAsync(string content)

Uploads a string of text to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadTextAsync(string content, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Uploads a string of text to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadTextAsync(string content, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Uploads a string of text to a file. If the file already exists on the service, it will be overwritten.

public virtual Task UploadTextAsync(string content, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Uploads a string of text to a file. If the file already exists on the service, it will be overwritten.

public virtual Task WriteRangeAsync(Uri sourceUri, long sourceOffset, long count, long destOffset, Checksum sourceContentChecksum = null, AccessCondition sourceAccessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = default)

Writes range from a source file to this file.

public virtual Task WriteRangeAsync(Stream rangeData, long startOffset, string contentMD5)

Writes range to a file.

public virtual Task WriteRangeAsync(Stream rangeData, long startOffset, string contentMD5, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext)

Writes range to a file.

public virtual Task WriteRangeAsync(Stream rangeData, long startOffset, string contentMD5, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)

Writes range to a file.

public virtual Task WriteRangeAsync(Stream rangeData, long startOffset, string contentMD5, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, IProgress<StorageProgress> progressHandler, CancellationToken cancellationToken)

Writes range to a file.