CreateFileShare method of the MSFT_FileServer class

Creates a file share on the file server.


UInt32 CreateFileShare(
  [in]  String              Name,
  [in]  String              Description,
  [in]  String              SourceVolume,
  [in]  String              VolumeRelativePath,
  [in]  Boolean             ContinuouslyAvailable,
  [in]  Boolean             EncryptData,
  [in]  UInt16              FileSharingProtocol,
  [out] String              CreatedFileShare,
  [out] MSFT_StorageJob REF CreatedStorageJob,
  [out] String              ExtendedStatus


Name [in]

A semi-unique (scoped to the owning file server), human-readable string used to identify the file share.

Description [in]

A user settable description of the file share. This field can be used to store extra free-form information, such as notes or details about the intended usage.

SourceVolume [in]

A string that contains an embedded MSFT_Volume object specifying the volume on which the share is to be created.

VolumeRelativePath [in]

The volume relative path of an existing directory to share. If this parameter is not provided, an empty share will be created.

ContinuouslyAvailable [in]

If TRUE, the share will be continuously available.

EncryptData [in]

If TRUE, the share data will be encrypted during transport.

FileSharingProtocol [in]

The file sharing protocol to be used by the share if the server supports more than one protocol.

NFS (2)


CreatedFileShare [out]

This parameter receives a string that contains an embedded MSFT_FileShare object representing the new file share.

CreatedStorageJob [out]

Returns a reference to the storage job object used to track the long-running operation.

ExtendedStatus [out]

A string that contains an embedded MSFT_StorageExtendedStatus object.

This parameter allows the storage provider to return extended (implementation-specific) error information.

Return value

Success (0)

Not Supported (1)

Unspecified Error (2)

Timeout (3)

Failed (4)

Invalid Parameter (5)

Method Parameters Checked - Job Started (4096)

Size Not Supported (4097)

Access denied (40001)

There are not enough resources to complete the operation. (40002)

The requested access path is already in use. (42002)

The access path is not valid. (42007)

You must specify a name for this file share. (58000)

You must specify a sharing protocol for this file share. (58001)

You must specify a volume for this file share. (58002)


Minimum supported client
Windows 10 [desktop apps only]
Minimum supported server
Windows Server 2016 [desktop apps only]

See also