Пример #1
0
        public ContactItem getContact(String contactKey)
        {
            try {
                ContactApi       contactApi = new ContactApi(session.GetApiClient());
                GetProfileResult result     = contactApi.GetProfile(contactKey);

                if (result.Hdr.Rc == 0)
                {
                    ProfileRecord record      = result.ProfileRecord;
                    ContactItem   contactItem = new ContactItem();
                    contactItem.Name          = record.DisplayName;
                    contactItem.Email         = record.Email;
                    contactItem.Phone         = record.Phone;
                    contactItem.Key           = record.UserKey;
                    contactItem.IconKey       = record.IconSmall;
                    contactItem.ProfileRecord = record;
                    return(contactItem);
                }
                else
                {
                    throw new Exception("Error getting contact");
                }
            } catch (Exception ex)
            {
                throw new Exception("Error getting contact", ex);
            }
        }