Replaces the contact information with information from the specified Contact
object. Uninitialized properties are cleared.
First, you usually call Contact_Load to get a contact by its ID, change some of its properties and then pass the updated object to Contacts_Update.
Requirements
The authenticating user must belong to a user group that has the Update privilege for Contacts.
Parameters
The operation uses the following parameters:
AuthenticationData : AuthenticationData, required
An AuthenticationData
object containing the login information and the project ID that contains the contact.
Contact : Contact, required
A Contact
object with the updated contact information.
SendEmailAlert : string, required
Y
means send an email alert to the subscribed users after updating the contact.
Any other value (for example, N
or empty string) means do not send e-mail alerts.
Result
None.
Remarks
The Contact
object has matching Id and Name properties, for example, AssigneeUserId
and AssignedToName
. To set them, specify the value only for the Id property. The corresponding Name property will be set automatically.
Example
Sample Code
C#
string login = "[email protected]";
string password = "p@ssword";
int projID = 10372;
// The ID of the contact to update
int id = 4;
ServiceSoapClient service = new ServiceSoapClient();
// Prepare AuthenticationData
LoginInfo loginInfo = service.GetLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.AppCode = loginInfo.AppCode;
authData.UserId = loginInfo.UserId;
authData.PassCode = password;
authData.DeptId = loginInfo.DeptId;
authData.ProjId = projID;
// Get a contact by its ID
Contact contact = service.Contacts_Load(authData, id);
// Change contact properties
contact.Status = "Closed";
contact.FolderId = 24;
// Upload the updated contact
service.Contacts_Update(authData, contact, "N");
Console.WriteLine("The contact was updated.");
Java
String login = "[email protected]";
String password = "p@ssword";
int projID = 10372;
// The ID of the contact to update
int id = 4;
ServiceSoap service = new Service().getServiceSoap12();
// Prepare AuthenticationData
LoginInfo loginInfo = service.getLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.setAppCode(loginInfo.getAppCode());
authData.setUserId(loginInfo.getUserId());
authData.setPassCode(password);
authData.setDeptId(loginInfo.getDeptId());
authData.setProjId(projID);
// Get a contact by its ID
Contact contact = service.contactsLoad(authData, id);
// Change contact properties
contact.setStatus("Closed");
contact.setFolderId(24);
// Upload the updated contact
service.contactsUpdate(authData, contact, "N");
System.out.println("The contact was updated.");
Sample Request XML
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 1014 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/Contacts_Update"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Contacts_Update xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
<Contact>
<ContactId>4</ContactId>
<ContactPerson>John Smith</ContactPerson>
<CompanyName>Smith & Doe Inc.</CompanyName>
<Email>[email protected]</Email>
<Title>Developer</Title>
<Status>Closed</Status>
<ContactType>Vendor</ContactType>
<Date1stContact>2012-02-20T00:00:00</Date1stContact>
<DateCallBack>2014-07-29T00:00:00</DateCallBack>
<AssigneeUserId>27942</AssigneeUserId>
<OwnerUserId>27534</OwnerUserId>
<AssignedToName>Fry, Alex</AssignedToName>
<DateCreated>2014-05-30T14:28:18.028</DateCreated>
</Contact>
<SendEmailAlert>N</SendEmailAlert>
</Contacts_Update>
</soap:Body>
</soap:Envelope>
SOAP 1.2
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1022 {Insert an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Contacts_Update xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
<Contact>
<ContactId>4</ContactId>
<ContactPerson>John Smith</ContactPerson>
<CompanyName>Smith & Doe Inc.</CompanyName>
<Email>[email protected]</Email>
<Title>Developer</Title>
<Status>Closed</Status>
<ContactType>Vendor</ContactType>
<Date1stContact>2012-02-20T00:00:00</Date1stContact>
<DateCallBack>2014-07-29T00:00:00</DateCallBack>
<AssigneeUserId>27942</AssigneeUserId>
<OwnerUserId>27534</OwnerUserId>
<AssignedToName>Fry, Alex</AssignedToName>
<DateCreated>2014-05-30T14:28:18.028</DateCreated>
</Contact>
<SendEmailAlert>N</SendEmailAlert>
</Contacts_Update>
</soap12:Body>
</soap12:Envelope>
Sample Response XML
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 309 {The server returns an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Contacts_UpdateResponse xmlns="http://www.pragmaticsw.com/" />
</soap:Body>
</soap:Envelope>
SOAP 1.2
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 319 {The server returns an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Contacts_UpdateResponse xmlns="http://www.pragmaticsw.com/" />
</soap12:Body>
</soap12:Envelope>
See Also
Contacts_Add
Contacts_Delete
Contacts_Load
Contacts_LoadByCriteria
Contacts Operations
SOAP API Reference