High-level Python bindings to Zarafa.
python-zarafa depends on the following modules:
- Python 2.6 or higher
- python-mapi (Provided by ZCP)
- python-daemon
- python-vobject Optional dependency for exporting MAPI items to vcard format (for contact.vcf())
Please keep in mind that this API is written to work on the latest version of Zarafa. Certain features may not work on older versions. The version on GitHub is taken directly from our 'trunk' branch.
Currently it is not recommended to install this release on a Zarafa server which runs a Zarafa release which provides a python-zarafa package such as Zarafa 7.2.
In certain cases the system installation of python-zarafa can cause an issue in existing provided software.
To install python-zarafa just simply run the following command.
$ python setup.py install Certain scripts require the more advanced features offered by the more recent version on GitHub. If you require the more advanced features you can do the following. Extract the download from GitHub.
$ mkdir python-zarafa $ cp python-zarafa-master/zarafa/__init__.py python-zarafa/zarafa.py $ cp myadvancedscript.py python-zarafa $ cd python-zarafa $ ./myadvancesscript.py This way you can use the GitHub version with your scripts without interfering whith the python-zarafa as provided by Zarafa.
To generate documentation just simply run the following command or visit the following url.
cd doc make singlehtml firefox _build/singlehtml/index.htmlimportzarafa# connect to server, as specified on command-line (possibly including SSL info) or via defaultsserver=zarafa.Server() # loop over users on this server, with 'parse' checking the command-line for specific user namesforuserinserver.users(parse=True): # some basic user infoprintuser.name, user.email, user.store.guid# print an indented overview of all folders in the user's default storeforfolderinuser.store.folders(recurse=True): printfolder.depth*' '+folder.name# print an overview of attachments in inboxforiteminuser.store.inbox: printitem.subjectforattachmentinitem.attachments(): printattachment.filename, len(attachment.data) # dive into MAPI if neededprintuser.props(), user.store.props()The following script lists the all the folders of all users on a remote server using SSL.
python scripts/list-folder-size.py -s https://remoteip:237/zarafa -k /etc/zarafa/ssl/server.pem -p password Or using the /etc/zarafa/admin.cfg configuration file and specifying a user
python scripts/list-folder-size.py -c /etc/zarafa/admin.cfg --user user1 Contents of list-folder-size.py
#!/usr/bin/env pythonimportzarafadefmain(): foruserinzarafa.Server().users(parse=True): print'user:', user.nameifuser.store: forfolderinuser.store.folders(recurse=True, system=True): print'regular: count=%s size=%s %s%s'% (str(folder.count).ljust(8), str(folder.size).ljust(10), folder.depth*' ', folder.name) if__name__=='__main__': main()