ShareDirectoryClient.CreateFileAsync Method

Definition

Creates a new file or replaces an existing file.

For more information, see Create File.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.Shares.ShareFileClient>> CreateFileAsync (string fileName, long maxSize, Azure.Storage.Files.Shares.Models.ShareFileHttpHeaders httpHeaders = default, System.Collections.Generic.IDictionary<string,string> metadata = default, Azure.Storage.Files.Shares.Models.FileSmbProperties smbProperties = default, string filePermission = default, Azure.Storage.Files.Shares.Models.ShareFileRequestConditions conditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateFileAsync : string * int64 * Azure.Storage.Files.Shares.Models.ShareFileHttpHeaders * System.Collections.Generic.IDictionary<string, string> * Azure.Storage.Files.Shares.Models.FileSmbProperties * string * Azure.Storage.Files.Shares.Models.ShareFileRequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.Shares.ShareFileClient>>
override this.CreateFileAsync : string * int64 * Azure.Storage.Files.Shares.Models.ShareFileHttpHeaders * System.Collections.Generic.IDictionary<string, string> * Azure.Storage.Files.Shares.Models.FileSmbProperties * string * Azure.Storage.Files.Shares.Models.ShareFileRequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.Shares.ShareFileClient>>
Public Overridable Function CreateFileAsync (fileName As String, maxSize As Long, Optional httpHeaders As ShareFileHttpHeaders = Nothing, Optional metadata As IDictionary(Of String, String) = Nothing, Optional smbProperties As FileSmbProperties = Nothing, Optional filePermission As String = Nothing, Optional conditions As ShareFileRequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of ShareFileClient))

Parameters

fileName
String

The name of the file.

maxSize
Int64

Required. Specifies the maximum size for the file in bytes. The max supported file size is 4 TiB.

httpHeaders
ShareFileHttpHeaders

Optional standard HTTP header properties that can be set for the file.

metadata
IDictionary<String,String>

Optional custom metadata to set for the file.

smbProperties
FileSmbProperties

Optional SMB properties to set for the file.

filePermission
String

Optional file permission to set for the file.

conditions
ShareFileRequestConditions

Optional ShareFileRequestConditions to add conditions on creating the file.

cancellationToken
CancellationToken

Optional CancellationToken to propagate notifications that the operation should be cancelled.

Returns

A Response<T> referencing the file.

Remarks

This method only initializes the file. To add content, use Azure.Storage.Files.Shares.ShareFileClient.UploadRangeAsync(Azure.HttpRange,System.IO.Stream,System.Byte[],System.IProgress{System.Int64},Azure.Storage.Files.Shares.Models.ShareFileRequestConditions,System.Threading.CancellationToken).

Applies to