# Class PstFolderWriter

java.lang.Object
com.independentsoft.pst.PstFolderWriter

public class PstFolderWriter extends Object
Represents a folder to be created in a new PST file (write side). Build a tree of these via `addFolder(String)` and pass the containing `PstStoreWriter` to save.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PstFolderWriter(String displayName)`
  Initializes a new instance of the `PstFolderWriter` class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PstFolderWriter`
  `addFolder(String displayName)`
  Adds a sub-folder with the specified display name and returns it.
  `PstMessageWriter`
  `addMessage(String subject, String body)`
  Adds a plain-text message (IPM.Note) to this folder and returns it.
  `String`
  `getDisplayName()`
  Gets the display name.
  `List<PstFolderWriter>`
  `getFolders()`
  Gets the sub-folders of this folder.
  `List<PstMessageWriter>`
  `getMessages()`
  Gets the messages contained in this folder.
  `void`
  `setDisplayName(String displayName)`
  Sets the display name.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PstFolderWriter

    public PstFolderWriter(String displayName)
    Initializes a new instance of the `PstFolderWriter` class.
    Parameters:
      `displayName` - the folder display name.

- ## Method Details

  - ### getDisplayName

    public String getDisplayName()
    Gets the display name.
    Returns:
      the display name.

  - ### setDisplayName

    public void setDisplayName(String displayName)
    Sets the display name.
    Parameters:
      `displayName` - the display name.

  - ### getFolders

    public List<PstFolderWriter> getFolders()
    Gets the sub-folders of this folder.
    Returns:
      the sub-folders.

  - ### addFolder

    public PstFolderWriter addFolder(String displayName)
    Adds a sub-folder with the specified display name and returns it.
    Parameters:
      `displayName` - the sub-folder display name.
    Returns:
      the created `PstFolderWriter`.

  - ### getMessages

    public List<PstMessageWriter> getMessages()
    Gets the messages contained in this folder.
    Returns:
      the messages.

  - ### addMessage

    public PstMessageWriter addMessage(String subject, String body)
    Adds a plain-text message (IPM.Note) to this folder and returns it.
    Parameters:
      `subject` - the message subject.
      `body` - the message body (plain text).
    Returns:
      the created `PstMessageWriter`.