I am trying to pull and read the entity from Dynamics CRM using C#. I am using retrieveMultiple
method and all I am getting is Microsoft.Xrm.Sdk.OptionSetValue
. When I debug I see 1000 records but every record is showing the same text Microsoft.Xrm.Sdk.OptionSetValue
. What am I doing wrong here?
QueryExpression bookQuery = new QueryExpression("new_res")
{
ColumnSet = new ColumnSet("new_book"),
Criteria =
{
Conditions =
{
new ConditionExpression()
{
AttributeName="new_bookid",
Operator = ConditionOperator.NotNull
}
}
}
};
DataCollection<Entity> bookList = service.RetrieveMultiple(bookeQuery).Entities;
foreach (var c in bookList)
{
Console.WriteLine(c.Attributes["new_bookid"]);
}
I just needed to use an EntityCollection
:
EntityCollection bookList = (EntityCollection)service.RetrieveMultiple(bookQuery);
if (bookList.Entities.Count > 0)
{
var record = bookList.Entities[0];
var recordNumberString = string.Empty;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.