putInFolder (Document - Java)

Adds a document to a folder. If the folder does not exist, it is created.

Defined in



public void putInFolder(String name)
    throws NotesException
public void putInFolder(String name, boolean createonfail)
    throws NotesException


String name

The name of the folder in which to place the document. The folder may be personal if the program is running on a workstation. If the folder is within another folder, specify a path to it, separating folder names with backslashes. For example:

boolean createonfail

If true (default), creates the folder if it does not exist.


If the document is already inside the folder you specify, putInFolder does nothing. If you specify a path to a folder, and none of the folders exists, the method creates all of them for you. For example:

doc.putInFolder( "Vehicles\\Bikes" );

If neither Vehicles nor Bikes exists, putInFolder creates both, placing the Bikes folder inside the Vehicles folder.

This method cannot add the first document to a folder that is "Shared, Personal on first use."

You cannot use this method on an unsaved document. Note that the method throws no error if you attempt to do so.