I am currently working on a script for my client for backing up all their addressbooks for each of their respective users, where i have hit a wall.

This is what i am using to backup the contacts:

/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL '/?fmt=csv&query=under:Contacts'
This is what i am using to backup the emailed contacts:

/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL '/?fmt=csv&query=under:Emailed Contacts'
Now the contacts command is giving me the csv, but the emailed contacts one is NOT. It just gives me the below error

ERROR: service.FAILURE (system failure: GET from https://mail.domain.com:443/home/user@domain.com/?fmt=csv&query=under:Emailed%20Contacts failed, status=404.  no such item)
Whereas when i go to the web interface, i see contacts under "Emailed Contacts".

Any ideas on where i am going wrong ?

Also i need a way to be able to get a list of all addressbooks users have. Example: A user created "Internal Users Addressbook", "Client X List". Now i want my script to be able to backup all of them, but unless i know their names, its difficult to do so.

The command i pointed above doesn't work for anything but the contacts folder. There has to be a way to get a list and then back them up. Or back them up all together.

Any help would be appreciated.