How to create a contact group from CLI: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
__FORCETOC__ | __FORCETOC__ | ||
<div class="col-md-12 ibox-content"> | <div class="col-md-12 ibox-content"> | ||
=How to create contact and contact group from CLI using Zmsoap command= | =How to create contact and contact group from CLI using Zmsoap command?= | ||
<hr> | <hr> | ||
{{KB|{{ | {{KB|{{ZC}}|{{ZCS 8.8}}||||}} | ||
====Problem==== | ====Problem==== | ||
How create contact and contact group from CLI using Zmsoap command and add local contact and GAL contact in the contact group? | How to create contact and contact group from CLI using Zmsoap command and add local contact and GAL contact in the contact group? | ||
====Solution==== | ====Solution==== | ||
====Create a local contact through the Zmsoap command.==== | ====Create a local contact through the Zmsoap command.==== | ||
Create the SOAP XML as per Zimbra SOAP API /tmp/createcontact.xml and add the following line | Create the SOAP XML as per Zimbra SOAP API - /tmp/createcontact.xml and add the following line to this file and save it : | ||
<CreateContactRequest xmlns="urn:zimbraMail"> | <CreateContactRequest xmlns="urn:zimbraMail"> | ||
Line 27: | Line 27: | ||
</CreateContactRequest> | </CreateContactRequest> | ||
Run the below command to create local contact: | Run the below command to create a local contact : | ||
$zmsoap -v -z -m user@domain.com -f /tmp/createcontact.xml | $zmsoap -v -z -m user@domain.com -f /tmp/createcontact.xml | ||
====Create a contact group through Zmsoap.==== | ====Create a contact group through Zmsoap.==== | ||
Create the SOAP XML as per Zimbra SOAP API /tmp/createcontact_group.xml and add the following line | Create the SOAP XML as per Zimbra SOAP API - /tmp/createcontact_group.xml and add the following line to this file and save : | ||
<CreateContactRequest xmlns="urn:zimbraMail"> | <CreateContactRequest xmlns="urn:zimbraMail"> | ||
Line 43: | Line 43: | ||
</CreateContactRequest> | </CreateContactRequest> | ||
Run the below command to create a contact group: | Run the below command to create a contact group : | ||
$zmsoap -v -z -m user@domain.com -f /tmp/createcontact.xml | $zmsoap -v -z -m user@domain.com -f /tmp/createcontact.xml | ||
Line 54: | Line 54: | ||
$zmmailbox -z -m user@domain.com gact >/tmp/getall_contact.txt | $zmmailbox -z -m user@domain.com gact >/tmp/getall_contact.txt | ||
Both group_id and contact_id can be found in this file /tmp/getall_contact.txt. | |||
====Add the GAL contact in contact group.==== | ====Add the GAL contact in contact group.==== | ||
$zmsoap -v -z -m test2@domain.com ModifyContactRequest/cn @id=group_id m/@op="+" @type="G" @value="uid=Gopal,ou=people,dc=domain,dc=com" | $zmsoap -v -z -m test2@domain.com ModifyContactRequest/cn @id=group_id m/@op="+" @type="G" @value="uid=Gopal,ou=people,dc=domain,dc=com" | ||
Here "group_id" is a contact group ID and "uid=Gopal,ou=people,dc=domain,dc=com" GAL contact | Here "group_id" is a contact group ID and "uid=Gopal,ou=people,dc=domain,dc=com" GAL contact that needs to be added to the contact group. | ||
Contact gopal@domain.com | Contact gopal@domain.com is saved in LDAP in this format "uid=Gopal,ou=people,dc=domain,dc=com" , replace UID with the actual contact name and domain. | ||
For more reference : Zimbra SOAP API [https://wiki.zimbra.com/wiki/SOAP_API_Reference_Material_Beginning_with_ZCS_8 external link] | |||
{{SubmittedBy|Gopal Singh Bhandari}} | {{SubmittedBy|Gopal Singh Bhandari}} | ||
{{Article Footer|ZCS 8.8|2020-07-10}} | {{Article Footer|ZCS 8.8|2020-07-10}} |
Latest revision as of 11:15, 3 November 2021
How to create contact and contact group from CLI using Zmsoap command?
Problem
How to create contact and contact group from CLI using Zmsoap command and add local contact and GAL contact in the contact group?
Solution
Create a local contact through the Zmsoap command.
Create the SOAP XML as per Zimbra SOAP API - /tmp/createcontact.xml and add the following line to this file and save it :
<CreateContactRequest xmlns="urn:zimbraMail"> <cn l="7"> <a n="firstName">Test</a> <a n="lastName">Test</a> <a n="homeStreet">Test street</a> <a n="mobilePhone">8000062359</a> <a n="fullName">Test, Test</a> <a n="email">test@gmail.com</a> </cn> </CreateContactRequest>
Run the below command to create a local contact :
$zmsoap -v -z -m user@domain.com -f /tmp/createcontact.xml
Create a contact group through Zmsoap.
Create the SOAP XML as per Zimbra SOAP API - /tmp/createcontact_group.xml and add the following line to this file and save :
<CreateContactRequest xmlns="urn:zimbraMail"> <cn l="7"> <a n="fileAs">8:testgroup</a> <a n="nickname">testgroup</a> <a n="type">group</a> <a n="fullName">testgroup</a> </cn> </CreateContactRequest>
Run the below command to create a contact group :
$zmsoap -v -z -m user@domain.com -f /tmp/createcontact.xml
Add the local contact in contact group.
$zmsoap -v -z -m user@domain.com ModifyContactRequest/cn @id=group_id m/@op="+" @type="C" @value="contact_id"
Here "group_id" is contact group ID and "contact_id" is the local contact ID.
Run the following command to get group_id and contact_id :
$zmmailbox -z -m user@domain.com gact >/tmp/getall_contact.txt
Both group_id and contact_id can be found in this file /tmp/getall_contact.txt.
Add the GAL contact in contact group.
$zmsoap -v -z -m test2@domain.com ModifyContactRequest/cn @id=group_id m/@op="+" @type="G" @value="uid=Gopal,ou=people,dc=domain,dc=com"
Here "group_id" is a contact group ID and "uid=Gopal,ou=people,dc=domain,dc=com" GAL contact that needs to be added to the contact group.
Contact gopal@domain.com is saved in LDAP in this format "uid=Gopal,ou=people,dc=domain,dc=com" , replace UID with the actual contact name and domain.
For more reference : Zimbra SOAP API external link
Submitted by: Gopal Singh Bhandari |