Skip to main content

Python classes for manipulating Lotus Notes/Domino objects via COM

Project description

NotesLib

NotesLib is a library of Python classes for manipulating (Lotus/IBM/HCL) Notes/Domino objects via COM.

NotesLib was created by Robert Follek, and the current maintainer is Marcelo Huerta.

(Please don't ask Robert about NotesLib, though: he released the code in text form some time ago, he doesn't work with Notes any more and the whole idea of updating the code and uploading it to PyPI can only be blamed on Marcelo. Who is not working actively with Notes at this time, so... responses can be slow.)

NotesLib depends on a proper installation and configuration of a Notes client on a Windows computer, as it interacts with the COM server that is part of a Notes installation for Windows and it expects a complete local configuration in place.

The Python version to be installed should be 32- or 64-bits depending on the version of the underlying COM server providing the objects accessed by the library. This means that for a Notes client up to version 11.x, you should install a 32-bit Python. Version 12.x is the first of the Notes clients to be 64-bit, so the COM server is also, and you need a 64-bit Python to interact with it.


We've received information that the COM server in version 12.0 and 12.0.1 had bugs and HCL solved the specific problems found in version 12.0.2. Caveat emptor: any underlying problems with the COM server are beyond the scope of this library.


The NotesLib classes correspond to the standard LotusScript classes; they support all the standard properties and methods. The NotesLib classes have additional methods and ease-of-use features. See below the details for the individual classes.

Classes available so far:

  • Session
  • Database
  • ACL
  • ACLEntry

Session

The Session class creates an COM connection to Notes. It supports all the properties and methods of the LotusScript NotesSession class, using the same syntax.

To create a Session object:

s = noteslib.Session(password)

or

s = noteslib.Session()

The password is optional; if you don't provide it, Notes will prompt you for a password.

Example:

>>> import noteslib
>>> s = noteslib.Session("password")
>>> s.NotesBuildVersion
166
>>> s.GetEnvironmentString("Directory", -1)
'd:\\notes5.8\\Data'
>>>

Session is a singleton - multiple Session variables share one Session object. You can instantiate Sessions as needed without a performance penalty, and you only have to establish a password once. Example:

>>> a = noteslib.Session(password)
>>> id(a)
8429868
>>> b = noteslib.Session()
>>> id(b)
8429868

Database

The Database class creates an COM connection to a Notes database. It supports all the properties and methods of the LotusScript NotesDatabase class, using the same syntax.

You don't have to create a Session first. A Database object creates its own Session automatically.

To create a Database object:

db = noteslib.Database(server, database_file, password)

or

db = noteslib.Database(server, database_file)

Example:

>>> import noteslib
>>> db = noteslib.Database("NYNotes1", "ACLTest.nsf", "password")
>>> db.Created
pywintypes.datetime(2001, 6, 30, 11, 12, 40, tzinfo=TimeZoneInfo('GMT Standard Time', True))

Multiple Database objects created for the same database are unique objects, but they share the same handle to the underlying NotesDatabase object. You can instantiate Database objects as needed without a performance penalty. Example:

>>> a = noteslib.Database("NYNotes1", "ACLTest.nsf", "password")
>>> id(a)
15281724
>>> id(a._Database__handle)
15286172
>>> b = noteslib.Database("NYNotes1", "ACLTest.nsf")
>>> id(b)
15270044
>>> id(b._Database__handle)
15286172

a and b are different objects, but they share the same internal NotesDatabase object via the __handle variable.

ACL

The ACL class encapsulates a Notes database ACL. It supports all the properties and methods of the LotusScript NotesACL class, using the same syntax.

Additional features:

  • You can print an ACL object. It knows how to format itself reasonably.
  • getAllEntries() method - Returns the ACL contents as a list of ACLEntry objects, sorted by Name.

You don't have to create Session or Database objects first. An ACL object creates its own Session and Database objects automatically.

To create an ACL object:

acl = noteslib.ACL(server, database_file, password)

or

acl = noteslib.ACL(server, database_file)

Example:

>>> import noteslib
>>> acl = noteslib.ACL("NYNotes1", "ACLTest.nsf", "password")
>>> for entry in acl.getAllEntries():
...     print (entry.getName())
...
-Default-
Alice Author
Anonymous
bob
Dave Depositor
Donna Designer
LocalDomainServers
OtherDomainServers
Randy Reader

ACLEntry

The ACLEntry class encapsulates a Notes database ACL entry. It supports all the properties and methods of the LotusScript NotesACLEntry class, using the same syntax.

Additional features:

  • You can print an ACLEntry object. It knows how to format itself reasonably.
  • getName() method - Returns the entry name.
  • getLevel() method - Returns the entry level.
  • getRoles() method - Returns a list of entry roles, sorted alphabetically.
  • getFlags() method - Returns a list of the ACLEntry flags, translated to strings.

These methods avoid the obvious names, e.g. getName() instead of name(), to avoid conflict with the existing NotesACLEntry properties.

Normally, you won't create an ACLEntry object directly. Instead, you can retrieve a list of ACLEntry objects from an ACL object, via its getAllEntries() method.

Example:

>>> import noteslib
>>> acl = noteslib.ACL("NYNotes1", "ACLTest.nsf", "password")
>>> print (acl.getAllEntries()[3])
Name : bob
Level: Manager
Role : [Role1]
Role : [Role2]
Role : [Role3]
Flag : Create Documents
Flag : Delete Documents
Flag : Create Personal Agents
Flag : Create Personal Folders/Views
Flag : Create Shared Folders/Views
Flag : Create LotusScript/Java Agent
Flag : Read Public Documents
Flag : Write Public Documents

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

noteslib-2.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

noteslib-2.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file noteslib-2.1.1.tar.gz.

File metadata

  • Download URL: noteslib-2.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for noteslib-2.1.1.tar.gz
Algorithm Hash digest
SHA256 86878b88e18f82941f71147816ea5ce7075dd7af6a34c32b72ad55adc2474ad3
MD5 5ca7385f1452a5f6cd62caf76cc2b622
BLAKE2b-256 fc15cb3e7dc80a7ef432ccd6b1293342c831397316638e9b65666f2d949bb5a7

See more details on using hashes here.

File details

Details for the file noteslib-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: noteslib-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for noteslib-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b85ce4362875cf251200701715aa9a1da81d7c93ea2cc28033858d3b464c286
MD5 27c84c6ff20a493c9d77926dd5e533e0
BLAKE2b-256 b8b698470edb8f8e7649168cef3b99c695a39bc5528b8586b9105ebd048dc89d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page