public void FindContacts()
 {
     var api = new ContactsApi();
     var req = new FindContactsRequest();
     req.Filters.Add(new FilterCriteria<ContactProperties> { Operation = FilterOperation.Like, TargetField = ContactProperties.LastName, Value = "Cast*" });
     api.FindContacts(req);
 }
Example #2
0
        public IEnumerable<ContactInfo> FindContacts(string firstname, string lastname, string company)
        {
            var request = new FindContactsRequest();

            if (!string.IsNullOrWhiteSpace(firstname))
            {
                request.Filters.Add(new FilterCriteria<ContactProperties> { Operation = FilterOperation.Like, TargetField = ContactProperties.FirstName, Value = firstname });
            }

            if (!string.IsNullOrWhiteSpace(lastname))
            {
                request.Filters.Add(new FilterCriteria<ContactProperties> { Operation = FilterOperation.Like, TargetField = ContactProperties.LastName, Value = lastname });
            }

            if (!string.IsNullOrWhiteSpace(company))
            {
                request.Filters.Add(new FilterCriteria<ContactProperties> { Operation = FilterOperation.Like, TargetField = ContactProperties.CompanyName, Value = company });
            }
            var service = new ContactsApi();
            return service.FindContacts(request);
        }