I am using following snippet to some items to a list of strings. But it is throwing an exception.
List<string> guids = null;
QueryExpression qExp = new QueryExpression
{
EntityName = "account",
ColumnSet = col1,
Criteria = new FilterExpression
{
Conditions = {
new ConditionExpression("statecode",ConditionOperator.Equal,0)
}
}
};
sp.CallerId = g1;
EntityCollection ec1 = sp.RetrieveMultiple(qExp);
foreach (Entity item in ec1.Entities)
{
guids.Add(Convert.ToString(item.Attributes["accountid"]));
}
Exception: Object reference not set to an instance of an object