ShareFileCreateOptions Class

  • java.lang.Object
    • com.azure.storage.file.share.options.ShareFileCreateOptions

public class ShareFileCreateOptions

Extended options that may be passed when creating a share.

Constructor Summary

Constructor Description
ShareFileCreateOptions(long size)

Creates a new instance of ShareFileCreateOptions.

Method Summary

Modifier and Type Method and Description
BinaryData getData()

Optional, valid for version 2026-02-06 and later.

String getFilePermission()

Gets the file permission.

FilePermissionFormat getFilePermissionFormat()

Gets the file permission format.

FilePropertySemantics getFilePropertySemantics()

Optional, only applicable to SMB files.

Map<String,String> getMetadata()

Gets the metadata to associate with the share.

FilePosixProperties getPosixProperties()

Optional properties to set on NFS files.

ShareRequestConditions getRequestConditions()

Gets the ShareRequestConditions.

ShareFileHttpHeaders getShareFileHttpHeaders()

Gets the file's http headers.

long getSize()

Gets the maximum size for the file share.

FileSmbProperties getSmbProperties()

Gets the optional SMB properties to set on the destination file or directory.

ShareFileCreateOptions setData(BinaryData binaryData)

Optional, valid for version 2026-02-06 and later.

ShareFileCreateOptions setFilePermission(String filePermissionKey)

Sets the file permission.

ShareFileCreateOptions setFilePermissionFormat(FilePermissionFormat filePermissionFormat)

Sets the file permission format.

ShareFileCreateOptions setFilePropertySemantics(FilePropertySemantics filePropertySemantics)

Optional, only applicable to SMB files.

ShareFileCreateOptions setMetadata(Map<String,String> metadata)

Sets the metadata to associate with the share.

ShareFileCreateOptions setPosixProperties(FilePosixProperties posixProperties)

Optional properties to set on NFS files.

ShareFileCreateOptions setRequestConditions(ShareRequestConditions requestConditions)

Sets the ShareRequestConditions.

ShareFileCreateOptions setShareFileHttpHeaders(ShareFileHttpHeaders headers)

Sets the file's http headers.

ShareFileCreateOptions setSmbProperties(FileSmbProperties smbProperties)

Sets the optional SMB properties to set on the destination file or directory.

Methods inherited from java.lang.Object

Constructor Details

ShareFileCreateOptions

public ShareFileCreateOptions(long size)

Creates a new instance of ShareFileCreateOptions.

Parameters:

size - Specifies the maximum size for the file share.

Method Details

getData

public BinaryData getData()

Optional, valid for version 2026-02-06 and later. Gets the content to upload to the file when it is created. Must be less than or equal to 4 MiB in size.

Returns:

getFilePermission

public String getFilePermission()

Gets the file permission.

Returns:

file permission.

getFilePermissionFormat

public FilePermissionFormat getFilePermissionFormat()

Gets the file permission format.

Returns:

file permission format.

getFilePropertySemantics

public FilePropertySemantics getFilePropertySemantics()

Optional, only applicable to SMB files. Gets how attributes and permissions should be set on the file. New: automatically adds the ARCHIVE file attribute flag to the file and uses Windows create file permissions semantics (ex: inherit from parent). Restore: does not modify file attribute flag and uses Windows update file permissions semantics. If Restore is specified, the file permission must also be provided, otherwise PropertySemantics will default to New.

Returns:

getMetadata

public Map<String,String> getMetadata()

Gets the metadata to associate with the share.

Returns:

Metadata to associate with the share

getPosixProperties

public FilePosixProperties getPosixProperties()

Optional properties to set on NFS files. Note that this property is only applicable to files created in NFS shares.

Returns:

getRequestConditions

public ShareRequestConditions getRequestConditions()

Gets the ShareRequestConditions.

Returns:

getShareFileHttpHeaders

public ShareFileHttpHeaders getShareFileHttpHeaders()

Gets the file's http headers.

Returns:

the file's http headers.

getSize

public long getSize()

Gets the maximum size for the file share.

Returns:

Specifies the maximum size for the file share.

getSmbProperties

public FileSmbProperties getSmbProperties()

Gets the optional SMB properties to set on the destination file or directory.

Returns:

Optional SMB properties to set on the destination file or directory. The only properties that are considered are file attributes, file creation time, file last write time, and file permission key. The rest are ignored.

setData

public ShareFileCreateOptions setData(BinaryData binaryData)

Optional, valid for version 2026-02-06 and later. Sets the content to upload to the file when it is created. Must be less than or equal to 4 MiB in size.

Parameters:

binaryData - The BinaryData.

Returns:

The updated options.

setFilePermission

public ShareFileCreateOptions setFilePermission(String filePermissionKey)

Sets the file permission.

Parameters:

filePermissionKey - the file permission.

Returns:

The updated options.

setFilePermissionFormat

public ShareFileCreateOptions setFilePermissionFormat(FilePermissionFormat filePermissionFormat)

Sets the file permission format.

Parameters:

filePermissionFormat - the file permission format.

Returns:

The updated options.

setFilePropertySemantics

public ShareFileCreateOptions setFilePropertySemantics(FilePropertySemantics filePropertySemantics)

Optional, only applicable to SMB files. Sets how attributes and permissions should be set on the file. New: automatically adds the ARCHIVE file attribute flag to the file and uses Windows create file permissions semantics (ex: inherit from parent). Restore: does not modify file attribute flag and uses Windows update file permissions semantics. If Restore is specified, the file permission must also be provided, otherwise PropertySemantics will default to New.

Parameters:

filePropertySemantics - FilePropertySemantics

Returns:

The updated options.

setMetadata

public ShareFileCreateOptions setMetadata(Map<String,String> metadata)

Sets the metadata to associate with the share.

Parameters:

metadata - Metadata to associate with the share. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.

Returns:

The updated options.

setPosixProperties

public ShareFileCreateOptions setPosixProperties(FilePosixProperties posixProperties)

Optional properties to set on NFS files. Note that this property is only applicable to files created in NFS shares.

Parameters:

posixProperties - FilePosixProperties

Returns:

The updated options.

setRequestConditions

public ShareFileCreateOptions setRequestConditions(ShareRequestConditions requestConditions)

Sets the ShareRequestConditions.

Parameters:

requestConditions - ShareRequestConditions

Returns:

The updated options.

setShareFileHttpHeaders

public ShareFileCreateOptions setShareFileHttpHeaders(ShareFileHttpHeaders headers)

Sets the file's http headers.

Parameters:

headers - the http headers.

Returns:

the updated options.

setSmbProperties

public ShareFileCreateOptions setSmbProperties(FileSmbProperties smbProperties)

Sets the optional SMB properties to set on the destination file or directory.

Parameters:

smbProperties - Optional SMB properties to set on the destination file or directory. The only properties that are considered are file attributes, file creation time, file last write time, and file permission key. The rest are ignored.

Returns:

The updated options.

Applies to