Search code examples
open-sourcescriptingsystem-administrationzimbra

How to update contacts in Zimbra by scripting?


I have a Zimbra installation and I need to programmaticaly update contacts in it. It seems that its REST interface is only working to add new contacts, but I need to update existing ones. Is there a way, tool or something, open-source, to do that ?


Solution

  • Well, I have an answer to my question : you may use the "zmmailbox" command. Under the Zimbra system user, it is possible to modify content in a mailbox. Since quite everything is stored in the Zimbra mailbox, contacts can be edited. I need now to find a way to use this :

    box$ 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...]]
        -i/--ignore                  ignore unknown contact attrs
        -f/--folder <arg>            folder-path-or-id
        -T/--tags <arg>              list of tag ids/names
    
      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...]]
        -i/--ignore                  ignore unknown contact attrs
        -r/--replace                 replace contact (default is to merge)
    
      moveContact(mct)             {contact-ids} {dest-folder-path}
    
      tagContact(tct)              {contact-ids} {tag-name} [0|1*]