CompactWithOptions (NotesDatabase - LotusScript®)

Compacts a local database allowing the submission of options.

Note: This method is new with Release 6.

Defined in



sizeDelta& = notesDatabase .CompactWithOptions( options$ )

sizeDelta& = notesDatabase .CompactWithOptions( options& [, spaceThreshold$ ] )



String. One or more command-line options supported by the Compact server task without the minus signs. Spaces are insignificant except that a space cannot be placed in the S option between the number and the final K, k, M, or m. Options are processed in their order of specification.


Constant of type Long. One or more of the following constants. Combine constants by adding.

  • CMPC_ARCHIVE_DELETE_COMPACT (1) a (archive and delete, then compact)
  • CMPC_ARCHIVE_DELETE_ONLY (2) A (archive and delete with no compact; supersedes a)
  • CMPC_CHK_OVERLAP (32768) o and O (check overlap)
  • CMPC_COPYSTYLE (16) c and C (copy style; supersedes b and B)
  • CMPC_DISABLE_DOCTBLBIT_OPTMZN (128) f (disable document table bit map optimization)
  • CMPC_DISABLE_LARGE_UNKTBL (4096) k (disable large unknown table)
  • CMPC_DISABLE_RESPONSE_INFO (512) H (disable "Don't support specialized response hierarchy")
  • CMPC_DISABLE_TRANSACTIONLOGGING (262144) t (disable transaction logging)
  • CMPC_DISABLE_UNREAD_MARKS (1048576) U (disable "Don't maintain unread marks")
  • CMPC_DISCARD_VIEW_INDICES (32) d and D (discard view indexes)
  • CMPC_ENABLE_DOCTBLBIT_OPTMZN (64) F (enable document table bit map optimization; supersedes f)
  • CMPC_ENABLE_LARGE_UNKTBL (2048) K (enable large unknown table; supersedes k)
  • CMPC_ENABLE_RESPONSE_INFO (256) h (enable "Don't support specialized response hierarchy"; supersedes H)
  • CMPC_ENABLE_TRANSACTIONLOGGING (131072) T (enable transaction logging; supersedes t)
  • CMPC_ENABLE_UNREAD_MARKS (524288) u (enable "Don't maintain unread marks"; supersedes U)
  • CMPC_IGNORE_COPYSTYLE_ERRORS (1024) i (ignore copy-style errors)
  • CMPC_MAX_4GB (16384) m and M (set maximum database size at 4 gigabytes)
  • CMPC_NO_LOCKOUT (8192) l and L (do not lock out users)
  • CMPC_RECOVER_INPLACE (8) B (recover unused space in-place and reduce file size; supersedes b)
  • CMPC_RECOVER_REDUCE_INPLACE (4) b (recover unused space in-place without reducing file size)
  • CMPC_REVERT_FILEFORMAT (65536) r and R (do not convert old file format)


String. Optional. The value of the S option (compact if specified percent or amount of unused space) without the S, for example, "10" for 10 percent, "10K" for 10 kilobytes, or "10M" for 10 megabytes.

Return value


Long. The difference in bytes between the size of the database before and after compacting.


This method must be run where the database is located, or it will produce an error. If the database is on the server, or accessible to that server via a mapped drive, the method must be run from the server. If the database resides on the Notes® client, the method must be run in the Notes® client. The method can not be run on one server to compact databases on another server.

A script cannot compact the current database (the database in which the script is running) or the desktop.dsk file.

The options are those that you can use with the Compact server task. For more information, see "Compact options" in Administration Help.

CompactWithOptions does not support the e or E option.