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
Printable View
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
Welcome to the forums :)
From within the web client, under preferences, you can import a csv contact list ?
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
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
Hello there,
Well, importing contacts from the web client import/export tool DON'T include tags.
A solution, the zmmailbox CLI command:
Its possible to pass a file containing all the createContact(cct) sub-commands with the -T option.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*]
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:
Some tips: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
- 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
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
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.Quote:
zmmailbox -z -m username gat
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.
Quote:
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
Is there any way to do this from the Zimbra Desktop? Or does this have to be done by my server administrator?
Thanks!