Results 1 to 8 of 8

Thread: Import contacts AND tags

  1. #1
    Join Date
    Mar 2010
    Posts
    7
    Rep Power
    5

    Default Import contacts AND tags

    Hello,

    Great job for this fabulous system! I'm new in that forum.

    Is there a way to import contacts from the web client import/export tool, including a field for tags?

    Thanks,
    --
    Versatil

  2. #2
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    Welcome to the forums

    From within the web client, under preferences, you can import a csv contact list ?

  3. #3
    Join Date
    Mar 2010
    Posts
    7
    Rep Power
    5

    Default

    Hello,

    Thanks for your answer, but I know that "from within the web client, under preferences, you can import a csv contact list".

    Precisely, is there a field for TAGS?

    --
    Versatil

  4. #4
    Join Date
    Apr 2008
    Location
    New Paltz, NY
    Posts
    336
    Rep Power
    7

    Default

    To my knowledge I don't think this is possible. When contacts are exported, tag information is not preserved so I'd be surprised if there was a way to import it.

    There is a (rather old - last activity September 2007) request for enhancement for this in Bugzilla:
    Bug 13246 – csv file import doesn't preserve categories tags

  5. #5
    Join Date
    Mar 2010
    Posts
    7
    Rep Power
    5

    Default

    Hello there,

    Well, importing contacts from the web client import/export tool DON'T include tags.

    A solution, the zmmailbox CLI command:
    Code:
    zimbra@cerise:~$ zmmailbox help contact
    
      autoComplete(ac)             [opts] {query}
        -v/--verbose                 verbose output
    
      autoCompleteGal(acg)         [opts] {query}
        -v/--verbose                 verbose output
    
      createContact(cct)           [opts] [attr1 value1 [attr2 value2...]]
        -f/--folder <arg>            folder-path-or-id
        -T/--tags <arg>              list of tag ids/names
        -i/--ignore                  ignore unknown contact attrs
    
      deleteContact(dct)           {contact-ids}
    
      flagContact(fct)             {contact-ids} [0|1*]
    
      getAllContacts(gact)         [opts] [attr1 [attr2...]]
        -f/--folder <arg>            folder-path-or-id
        -v/--verbose                 verbose output
    
      getContacts(gct)             [opts] {contact-ids} [attr1 [attr2...]]
        -v/--verbose                 verbose output
    
      modifyContactAttrs(mcta)     [opts] {contact-id} [attr1 value1 [attr2 value2...]]
        -r/--replace                 replace contact (default is to merge)
        -i/--ignore                  ignore unknown contact attrs
    
      moveContact(mct)             {contact-ids} {dest-folder-path}
    
      tagContact(tct)              {contact-ids} {tag-name} [0|1*]
    Its possible to pass a file containing all the createContact(cct) sub-commands with the -T option.

    What you only have to do is to create this file from the csv you wanted to import with the web client import/export tool. I have used the awk utily to do that job:
    Code:
    awk 'BEGIN { FS = ";" ; RS = "£" } ; {print "zmmailbox -z -m user@domain.com createContact -T " $24 " company " $1 " lastName " $2 " firstName " $3
    " jobTitle " $4 " email " $5 " email2 " $6 " workStreet " $7 " workCity " 
    $8 " workPostalCode " $9 " workCountry " $10 " workURL " $11 " workPhone 
    " $12 " workFax " $13 " workPhone2 " $14 " homeStreet " $15 " homeCity " 
    $16 " homePostalCode " $17 " homeCountry  " $18 " homePhone " $19 " 
    homeFax " $20 " mobilePhone " $21 " homeURL " $22 " notes " $23 }' < file-to-import.csv
    Some tips:
    • RS = "£": in Zimbra, some fields can use multiple lines (notes, workStreet tec.) so you have to tune awk for use multiple lines records.
    • Some records may not have tags, so the awk output generated commands with -T "". -T "" generate errors. So have to delete that string (with a search/replace function), in the commands file generated by awk before his execution.
    • Don't forget to create the corrects tags in Zimbra before!


    --
    versatil

  6. #6
    Join Date
    Dec 2008
    Location
    Ontario, Canada
    Posts
    7
    Rep Power
    6

    Default

    Well I just spent all morning wrestling with this, so I figured I'll post my results here.

    First, the above awk magic from versatil looks promising, but I didn't seem to have the same csv file format that he was using. I noticed that if I chose to export to "Outlook contacts", then the resulting CSV file did have the field "CATEGORY". So theoretically just rearranging that awk command could have helped, and I would have done this for a smaller number of lines. I was dealing with hundreds of contacts, with multiple-line notes and other complications.

    So. I eventually discovered that the REST down/up-loads *do* actually contain tag information. The problem is that they refer to the tags by id, not by name.

    My source/destination servers were the result of zmztozmig, and the actual tags themselves had been created for me on the new server. Same name, different IDs.

    On each server, you can see the user's tag list like so

    zmmailbox -z -m username gat
    I found that using a combination of createTag, deleteTag, and renameTag, I was able to make the destination server's tag list have the same IDs as the source server.

    Once the tags have the same ID's on source and destination server, the REST file format download and upload resulted in the desired effect: the destination address book now shows each contact as having the same tags it had in the source.

    curl -u username : password http://server/service/home/username/contacts.tgz

    curl -u username : password --upload-file contacts.tgz ttp://server/service/home/username/contacts?fmt=tgz

  7. #7
    Join Date
    Dec 2010
    Posts
    1
    Rep Power
    4

    Default

    Is there any way to do this from the Zimbra Desktop? Or does this have to be done by my server administrator?

    Thanks!

  8. #8
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,587
    Rep Power
    58

    Default

    Quote Originally Posted by JonScrut View Post
    Is there any way to do this from the Zimbra Desktop? Or does this have to be done by my server administrator?
    If you're talking about the commands in the post above yours then it's for the Zimbra Collaboration Suite and it's not possible to do them for Zimbra Desktop.
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

Similar Threads

  1. Replies: 1
    Last Post: 04-03-2010, 05:40 PM
  2. Tags across Documents, Emails, Contacts,...
    By gstevano in forum Users
    Replies: 1
    Last Post: 01-12-2009, 03:21 AM
  3. How to group contacts for Shared Users
    By pbrunnen in forum Administrators
    Replies: 1
    Last Post: 01-18-2008, 12:36 PM
  4. Shared Contacts - Grouping
    By pbrunnen in forum Users
    Replies: 0
    Last Post: 01-15-2008, 06:30 PM
  5. export Tags?
    By shankwc in forum Administrators
    Replies: 1
    Last Post: 07-31-2007, 08:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •