CRM4: Useful snippet to get user or contact by email address

Useful snippet of code that i use all the time, may be helpful to others… public Guid getUserByEmailAddress(String email, CrmService service) {QueryExpression query = new QueryExpression(); query.EntityName = “systemuser”; ColumnSet columns = new ColumnSet(); columns.Attributes.Add(“systemuserid”); query.ColumnSet = columns; query.Criteria = new FilterExpression(); query.Criteria.FilterOperator = LogicalOperator.And; ConditionExpression condition1 = new ConditionExpression(); condition1.AttributeName = “internalemailaddress”; condition1.Operator = […]