Service: zimbraMail

Command: CreateContact
Namespace: urn:zimbraMail
Description: Create a contact
Properties:
Authorization token required true
Admin Authorization token required false

CreateContactRequest

    <CreateContactRequest [verbose="{verbose} (0|1)"] [wantImapUid="{want-imap-uid} (0|1)"]
                             [wantModSeq="{want-modified-sequence} (0|1)"]> ## CreateContactRequest
        <cn [id="{id} (Integer)"] [l="{folder-id}"] [t="{tags}"] [tn="{tag-names}"]> ## ContactSpec
            <vcard [mid="{message-id}"] [part="{part-identifier}"] [aid="{uploaded-attachment-id}"]>{value}</vcard> ## VCardInfo
            (<a n="{attr-name}" [aid="{upload-id}"] [id="{item-id} (Integer)"] [part="{subpart-name}"]>{value}</a> ## NewContactAttr)*
            (<m type="{member-type}" value="{member-value}" /> ## NewContactGroupMember)*
        </cn>
    </CreateContactRequest>

elements and attributes you can define within a <CreateContactRequest> element:

XPath Required / Optional Description
@verbose Optional (0 or 1) Type: 0|1
If set (defaults to unset) The returned <cn> is just a placeholder containing the new contact ID (i.e. <cn id="{id}"/>)
@wantImapUid Optional (0 or 1) Type: 0|1
Set to return IMAP UID. (default is unset.)
@wantModSeq Optional (0 or 1) Type: 0|1
Set to return Modified Sequence. (default is unset.)
/cn Required (only 1) Contact specification
/cn@id Optional (0 or 1) Type: Integer
ID - specified when modifying a contact
/cn@l Optional (0 or 1) Type: String
ID of folder to create contact in. Un-specified means use the default Contacts folder.
/cn@t Optional (0 or 1) Type: String
Tags - Comma separated list of integers. DEPRECATED - use "tn" instead
/cn@tn Optional (0 or 1) Type: String
Comma-separated list of tag names
/cn/vcard Optional (0 or 1) Type: {value}
Either a vcard or attributes can be specified but not both.
Description for element text content:inlined VCARD data
/cn/vcard@mid Optional (0 or 1) Type: String
Message ID. Use in conjunction with {part-identifier}
/cn/vcard@part Optional (0 or 1) Type: String
Part identifier. Use in conjunction with {message-id}
/cn/vcard@aid Optional (0 or 1) Type: String
Uploaded attachment ID
/cn/a Optional (0 or more) Type: {value}
Contact attributes. Cannot specify <vcard> as well as these
Description for element text content:Attribute data
Date related attributes like "birthday" and "anniversary" SHOULD use "yyyy-MM-dd" format or, if the year isn't specified "--MM-dd" format
/cn/a@n Required (only 1) Type: String
Attribute name
/cn/a@aid Optional (0 or 1) Type: String
Upload ID
/cn/a@id Optional (0 or 1) Type: Integer
Item ID. Used in combination with subpart-name
/cn/a@part Optional (0 or 1) Type: String
Subpart Name
/cn/m Optional (0 or more) Contact group members. Valid only if the contact being created is a contact group (has attribute type="group")
/cn/m@type Required (only 1) Type: String
Member type
C reference to another contact
G reference to a GAL entry
I inlined member (member name and email address is embeded in the contact group)
/cn/m@value Required (only 1) Type: String
Member value
type="C" Item ID of another contact. If the referenced contact is in a shared folder, the item ID must be qualified by zimbraId of the owner. e.g. {zimbraId}:{itemId}
type="G" GAL entry reference (returned in SearchGalResponse)
type="I" name and email address in the form of: "{name}" <{email}>

CreateContactResponse

    <CreateContactResponse> ## CreateContactResponse
        <cn [sf="{contact-sort-field}"] [exp="{can-expand} (0|1)"] id="{contact-id}" [i4uid="{imap-uid} (Integer)"]
                [l="{contact-folder-id}"] [f="{contact-flags}"] [t="{contact-tags}"] [tn="{contact-tag-names}"]
                [md="{contact-modified-date-secs} (Long)"] [ms="{contact-modified-seq} (Integer)"]
                [d="{contact-date-millis} (Long)"] [rev="{saved-sequence-number} (Integer)"] [fileAsStr="{contact-file-as}"]
                [email="{contact-email}"] [email2="{contact-email2}"] [email3="{contact-email3}"] [type="{contact-type}"]
                [dlist="{contact-dlist}"] [ref="{contact-gal-entry-ref}"]
                [tooManyMembers="{contact-too-many-members} (0|1)"]> ## ContactInfo
            (<meta [section="{section}"]> ## MailCustomMetadata
                (<a n="{key}">{value}</a> ## KeyValuePair)*
              </meta>)*
            (<a [part="{contact-part-id}"] [ct="{contact-content-type}"] [s="{contact-size} (Integer)"]
                    [filename="{contact-content-filename}"] n="{key}" /> ## ContactAttr)*
            (<m type="{member-type}" value="{member-value}"> ## ContactGroupMember
                <cn> ... </cn> ## See /cn [ ## ContactInfo] # [inside itself]
              </m>)*
            <memberOf>{memberOf} (String)</memberOf>
         </cn>
    </CreateContactResponse>

elements and attributes you can define within a <CreateContactResponse> element:

XPath Required / Optional Description
/cn Optional (0 or 1) Details of the contact. Note that if verbose was not set in the request, the returned <cn> is just a placeholder containing the new contact ID (i.e. <cn id="{id}"/>)
/cn@sf Optional (0 or 1) Type: String
Sort field value
/cn@exp Optional (0 or 1) Type: 0|1
Set if the user can (has right to) expand group members. Returned only if needExp is set in the request and only on group entries (type=group in attrs on a <cn>).
/cn@id Required (only 1) Type: String
Unique contact ID
/cn@i4uid Optional (0 or 1) Type: Integer
IMAP UID
/cn@l Optional (0 or 1) Type: String
Folder ID. When creating a contact, this is the ID of the folder to create the contact in
/cn@f Optional (0 or 1) Type: String
Flags. {flags} = (f)lagged, has (a)ttachment
/cn@t Optional (0 or 1) Type: String
Tags - Comma separated list of integers. DEPRECATED - use "tn" instead
/cn@tn Optional (0 or 1) Type: String
Comma-separated list of tag names
/cn@md Optional (0 or 1) Type: Long
Modified date in seconds
/cn@ms Optional (0 or 1) Type: Integer
Modified sequence
/cn@d Optional (0 or 1) Type: Long
Date in milliseconds
/cn@rev Optional (0 or 1) Type: Integer
Saved sequence number
/cn@fileAsStr Optional (0 or 1) Type: String
Current "file as" string for display/sorting purposes; cannot be used to set the file-as value
/cn@email Optional (0 or 1) Type: String
Contact email address
/cn@email2 Optional (0 or 1) Type: String
Contact email address 2
/cn@email3 Optional (0 or 1) Type: String
Contact email address 3
/cn@type Optional (0 or 1) Type: String
Contact type
/cn@dlist Optional (0 or 1) Type: String
Contact dlist
/cn@ref Optional (0 or 1) Type: String
GAL entry reference
/cn@tooManyMembers Optional (0 or 1) Type: 0|1
If number of members on a GAL group is greater than the specified max, do not return any members for the entry. Instead, set "tooManyMembers.
/cn/meta Optional (0 or more) Custom metadata information
/cn/meta@section Optional (0 or 1) Type: String
Section.
Normally present. If absent this indicates that CustomMetadata info is present but there are no sections to report on.
/cn/meta/a Optional (0 or more) Type: {value}
Key value pairs
Description for element text content:Value
/cn/meta/a@n Required (only 1) Type: String
Key
/cn/a Optional (0 or more) Attributes
/cn/a@part Optional (0 or 1) Type: String
Part ID.
Can only specify a {contact-part-id} when modifying an existent contact
/cn/a@ct Optional (0 or 1) Type: String
Content type
/cn/a@s Optional (0 or 1) Type: Integer
Size
/cn/a@filename Optional (0 or 1) Type: String
Content filename
/cn/a@n Required (only 1) Type: String
Key
/cn/m Optional (0 or more) Contact group members
/cn/m@type Required (only 1) Type: String
Member type
C reference to another contact
G reference to a GAL entry
I inlined member (member name and email address is embeded in the contact group)
/cn/m@value Required (only 1) Type: String
Member value
type="C" Item ID of another contact. If the referenced contact is in a shared folder, the item ID must be qualified by zimbraId of the owner. e.g. {zimbraId}:{itemId}
type="G" GAL entry reference (returned in SearchGalResponse)
type="I" name and email address in the form of: "{name}" <{email}>
/cn/m/cn Optional (0 or 1) Contact information for dereferenced member.
See /cn for more details.
/cn/memberOf Optional (0 or 1) Type: {memberOf} (String)
Comma separated list of IDs of contact groups this contact is a member of.
Only provided if requested