Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-17-2009, 09:15 AM
Intermediate Member
 
Posts: 22
Default Command line export addressbook ??????

Hi!!!

Where I work we have one user ( centralinist ) who share a contacts folder. This folder have many subfolders containing all public contatcts (all customers, all emplyes ecc ecc.).

My old but very big boss don't want to use PC and I have to print addressbook for him.

Zimbra print output isn't usefoul and I have to make a layout customized but It's no possible in zimbra.

So I need to a batch procedure that nighly export all contacts in some format (and later import it into a database and create a with same report manager a customized report).

Is possible to make a similar export as CSV or something similar from command line?
Reply With Quote
  #2 (permalink)  
Old 03-17-2009, 09:52 AM
Moderator
 
Posts: 6,237
Default

as root or zimbra:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "/Contacts?fmt=csv" > /tmp/user-contacts.csv


or via:
Code:
https://user@domain.com.com:thepass@srv.domain.com/zimbra/home/user@domain.com/Contacts.csv
(with or without their password depending on how your authing; previous token, as admin, etc)
Reply With Quote
  #3 (permalink)  
Old 03-17-2009, 10:16 AM
Intermediate Member
 
Posts: 22
Default

Quote:
Originally Posted by mmorse View Post
as root or zimbra:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "/Contacts?fmt=csv" > /tmp/user-contacts.csv
It's that I need but don't work....

I've just run it without redirection to file and reply is one empty row.

structure is:

Code:
Contacts (empty) -
                  -> "Public Folder" (shared but empty) - 
                                                         -> Customers
                                                         -> Banks
                                                         -> Employed
                                                         -> ecc ecc
Reply With Quote
  #4 (permalink)  
Old 03-17-2009, 11:16 AM
Moderator
 
Posts: 6,237
Default

Adjust your search a little:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "/?fmt=csv&query=under:Contacts" > /tmp/user-contacts.csv

Bug 15161 - add a 'recursive' option for REST fetch

In the below example email2@domain.com is in /Contacts/Test
Quote:
# /opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "/Contacts?fmt=csv"
"email","firstName","fullName","lastName","middleN ame"
"email@domain.com","first","first middle last","last","middle"

vs

# /opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "/?fmt=csv&query=under:Contacts"
"email","firstName","fullName","lastName","middleN ame"
"email2@domain.com","f2","f2 m2 l2","l2","m2"
"email@domain.com","first","first middle last","last","middle"
Reply With Quote
  #5 (permalink)  
Old 03-18-2009, 05:11 AM
Intermediate Member
 
Posts: 22
Default

Ok, partially solved....

"Public folder" was at the same level of contacts so:

Code:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "/?fmt=csv&query=under:Public folder"
but empty space between "public" and "folder" is a problem.This don't work:
Code:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL '/?fmt=csv&query=under:Public folder'
as this:
Code:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL "/?fmt=csv&query=under:Public%20folder"
so renaming it into "PublicFolder" I could see csv.

there is a way to customize CSV output?
I need to know if a row is under publicFolder/Banks, or PublicFolder/Customers ecc ecc.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.