I'm trying to make a query in order to retrieve all record containing one of the text in a string list.
QueryExpression query = new QueryExpression("account")
{
ColumnSet = new ColumnSet("primarycontactid", "new_text"),
NoLock = true,
Criteria =
{
Conditions =
{
new ConditionExpression()
{
AttributeName = "new_text",
Operator = ConditionOperator.In,
Values = { texts.ToArray() }
}
}
}
};
This code execute without issue, but don't return any record.
I also tried the following code, which resulted in the return of multiple record.
QueryExpression query = new QueryExpression("account")
{
ColumnSet = new ColumnSet("primarycontactid", "new_text"),
NoLock = true,
Criteria =
{
Conditions =
{
new ConditionExpression()
{
AttributeName = "new_text",
Operator = ConditionOperator.Equal,
Values = { texts.ToArray()[0] }
}
}
}
};
I also tried, without error, but with no return.
QueryExpression query = new QueryExpression("account")
{
ColumnSet = new ColumnSet("primarycontactid", "new_text"),
NoLock = true,
Criteria =
{
Conditions =
{
new ConditionExpression()
{
AttributeName = "new_text",
Operator = ConditionOperator.Equal,
Values = { texts.ToArray() }
}
}
}
};
How can I do in order to query with a list of values ?
The below syntax should work.
Alternate version:
Read more