You can use ContactSearchBasic
. I added one filter to exclude inactive records but if you want those just strip that out. Sample is C# but you should get the idea.
ContactSearchBasic contactSearchBasic = new ContactSearchBasic();
contactSearchBasic.isInactive = new SearchBooleanField();
contactSearchBasic.isInactive.searchValue = false;
contactSearchBasic.isInactive.searchValueSpecified = true;
SearchResult searchResult = _service.search(contactSearchBasic);
if (searchResult.status.isSuccess)
{
foreach (Record contactRecord in searchResult.recordList)
{
if (contactRecord is Contact)
{
Contact contact = (Contact)(contactRecord);
//do something with the contact record
}
}
}