1

I want to export all users' contacts (Address book) in csv format for migration purpose. Zimbra is runing on ubuntu and I want to do this from cli. How shall I proceed? I have refereed to this link but this is not an option for me.

Kindly let me know if you want any more details.

1
  • What is your migration target? What are you hoping to migrate?
    – 84104
    Mar 17, 2016 at 16:44

2 Answers 2

4

Not sure if you want to do this on a Zimbra server, but if it is a server you can use zmmailbox with a getRestUrl for almost all things that can be done in the web interface. Become the zimbra user

zmmailbox -z -m [email protected] -t 0 getRestURL "//contacts?fmt=csv"

This is a basic csv export, mainly compatible with Zimbra. You can make the exports more compatible with other applications by replacing the csv with one of the following options:

  • zimbra-csv
  • yahoo-csv
  • thunderbird-csv
  • outlook-2000-csv
  • outlook-2003-csv

To make an outlook 2003 compatible export you the command changes to:

zmmailbox -z -m [email protected] -t 0 getRestURL "//contacts?fmt=outlook-2003-csv"

To make an export from a different adressbook, you can use the name of that adressbook f.e.:

zmmailbox -z -m [email protected] -t 0 getRestURL "//privatecontacts?fmt=outlook-2003-csv"
0

On the command line (as the zimbra user) you can use the commands zmprov and zmmailbox to access user accounts, folders (mail, contacts, calendars) and folder content.

Use

zimbra@mail:~$ zmprov help

or

zimbra@mail:~$ zmmailbox help

to see what commands are available.

As an example for accessing a user's contacts from the main contacts folder use:

zmmailbox -z -m [email protected] getAllContacts -f "/Contacts"

But this command does not provide csv output, so read on.


There is also a Rest API for accessing Zimbra content.

The parameter fmt only takes the following values:

  • csv
  • json
  • xml
  • tgz
  • zip

If you are using fmt=csv you can additionally specify the csv format with the parameter csvfmt and one of the following values:

  • zimbra-csv
  • yahoo-csv
  • thunderbird-csv
  • outlook-2000-csv
  • outlook-2003-csv

So the entire command could look as follows:

zmmailbox -z -m [email protected] -t 0 getRestURL "/Contacts?fmt=csv&csvfmt=outlook-2003-csv"

Additional information can be found here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .