Click or drag to resize
GDStorageFolderCreateFolderAsync Method (String, CreationCollisionOption)
Creates a new subfolder with the specified name in the current folder. This method also specifies what to do if a subfolder with the same name already exists in the current folder.

Namespace:  GD
Assembly:  GD (in GD.dll) Version: 255.255.255.255
Syntax
public IAsyncOperation<GDStorageFolder> CreateFolderAsync(
	string desiredName,
	CreationCollisionOption options
)

Parameters

desiredName
Type: SystemString
The name of the new subfolder to create in the current folder.
options
Type: Windows.StorageCreationCollisionOption
One of the enumeration values that determines how to handle the collision if a subfolder with the specified desiredName already exists in the current folder.

Return Value

Type: IAsyncOperationGDStorageFolder
When this method completes, it returns a GDStorageFolder that represents the new subfolder.

Implements

IGDStorageFolderCreateFolderAsync(String, CreationCollisionOption)
Exceptions
ExceptionCondition
ExceptionYou specified FailIfExists and a subfolder with the specified desiredName already exists in the current folder or some unexpected error occurred.
AccessDeniedExceptionSecure storage was remotely wiped or options was specified as OpenIfExists or ReplaceExisting and file with same name as desiredName already exists.
InvalidArgumentExceptionThe folder name contains invalid characters, or the format of the folder name is incorrect. Check the value of desiredName or unsupported value of options was given.
Remarks

If a folder with the specified desiredName already exists in the current folder, the specified CreationCollisionOption determines how to handle the collision.

If you try to create a subfolder in a folder that represents a container for a group of files (for example, the return value from some overloads of the GetFoldersAsync method), the CreateFolderAsync(String, CreationCollisionOption) method may fail.

Note: No leading nor trailing spaces are stripped from desiredName.

Examples
The following example shows how to create a new GDStorageFolder in a SDK secure folder. This example explicitly specifies a value for options that causes the operation to fail if a folder with the specified desiredName already exists in the current folder.
using GD;

var secureSubfolder = await GDWindows.Instance.SecureFolder.CreateFolderAsync("SubFolder", CreationCollisionOption.FailIfExists);
See Also