FolderInfo.AddSubFolder

AddSubFolder(string, bool)

Adds the new sub-folder.

public FolderInfo AddSubFolder(string name, bool createHierarchy)
ParameterTypeDescription
nameStringThe name of sub-folder.
createHierarchyBooleanif set to true, it is possible to create a folder hierarchy using string notation. Backslash (’') is used as path separator.

Return Value

The new sub-folder.

Exceptions

exceptioncondition
NotImplementedExceptionthrows, if a PST file version is ANSI.
ArgumentNullExceptionthrows, if a sub-folder name is null or empty.
InvalidOperationExceptionthrows, if a PST is open for reading only.

See Also


AddSubFolder(string)

Adds the new sub-folder.

public FolderInfo AddSubFolder(string name)
ParameterTypeDescription
nameStringThe name of sub-folder.

Return Value

The new sub-folder.

Exceptions

exceptioncondition
NotImplementedExceptionthrows, if a PST file version is ANSI.
ArgumentNullExceptionthrows, if a sub-folder name is null or empty.
InvalidOperationExceptionthrows, if a PST is open for reading only.
InvalidOperationExceptionthrows, if a folder with same name already exists. The comparison will be case-insensitive, and the folder creation operation will consider folders with the same name but different casing as duplicates.

See Also


AddSubFolder(string, string)

Adds the new subfolder.

public FolderInfo AddSubFolder(string name, string containerClass)
ParameterTypeDescription
nameStringThe name of subfolder.
containerClassStringContainer class of the sub-Folder object.

Return Value

The new subfolder.

Exceptions

exceptioncondition
NotImplementedExceptionthrows, if a PST file version is ANSI.
ArgumentNullExceptionthrows, if a subfolder name is null or empty.
InvalidOperationExceptionthrows, if a PST is open for reading only.
InvalidOperationExceptionthrows, if a folder with same name already exists. The comparison will be case-insensitive, and the folder creation operation will consider folders with the same name but different casing as duplicates.

See Also


AddSubFolder(string, FolderCreationOptions)

Adds a subfolder with the specified name to the current folder using the provided creation options.

public FolderInfo AddSubFolder(string name, FolderCreationOptions creationOptions)
ParameterTypeDescription
nameStringThe name of the subfolder to add.
creationOptionsFolderCreationOptionsThe options for creating the subfolder.

Return Value

The FolderInfo representing the added subfolder.

Exceptions

exceptioncondition
NotImplementedExceptionthrows, if a PST file version is ANSI.
ArgumentNullExceptionthrows, if a subfolder name is null or empty.
InvalidOperationExceptionthrows, if a PST is open for reading only.
InvalidOperationExceptionthrows, if a folder with same name already exists. Whether folders have the same name will depend on the AllowNameCaseDifference parameter.

Remarks

The name parameter specifies the name of the subfolder to add. The creationOptions parameter allows customization of the subfolder creation behavior, such as specifying whether to create the hierarchy of parent folders and the container class of the new subfolder. If the subfolder with the specified name already exists, the behavior depends on the value of AllowNameCaseDifference. If AllowNameCaseDifference is set to true, a difference in name casing will be allowed, and the subfolder will be added even if an existing folder with the same name but in a different case exists. If AllowNameCaseDifference is set to false, the comparison will be case-insensitive, and an InvalidOperationException will be thrown to indicate that a folder with the specified name already exists. The name may contain backslash () as the path separators (for example, “parent1\parent2\subfolder”). In this case if CreateHierarchy is set to true, the hierarchy of parent folders should be created.

See Also