Finding a Contact by Email Address

This code block returns a Salesforce Contact record to Sitecore based on the email address.

SalesforceSession salesforceSession = new SalesforceSession(new LoginDetails("username@example.com", "salesforcePassword"));
ContactDataSource contactDataSource = new ContactDataSource(salesforceSession);
 
string emailToFind = "@edge.com";
 
contactDataSource.AddDataSourceFilter("email", ComparisonOperator.Contains, emailToFind);
contactDataSource.AddDataSourceFilter("IsDeleted", ComparisonOperator.NotEquals, true);
 
var queryResult = contactDataSource.RunQuery();
 
List<Contact> contacts = contactDataSource.EntitysFromQueryResult<Contact>(queryResult);