0
我遇到了需要根據給定電子郵件地址返回記錄的GUID的方法問題。這是我的時刻:MS Dynamics 4.0:根據電子郵件地址檢查記錄是否存在
ColumnSet columnSet = new ColumnSet();
columnSet.AddColumns(new[] { "leadid" });
var query = new QueryExpression
{
EntityName = "lead",
ColumnSet = columnSet
};
FilterExpression leadFilter = new FilterExpression();
leadFilter.AddCondition(new ConditionExpression
{
AttributeName = "emailaddress1",
Operator = ConditionOperator.Equal,
Values = new object[] { emailAddress }
});
query.Criteria = leadFilter;
BusinessEntityCollection result = crmService.RetrieveMultiple(query);
foreach (BusinessEntity record in result)
{
//Guid leadId = ?? Not sure how to extract it.
}
A)這似乎有點小題大做,因爲我只需要一個記錄(但不認爲我可以使用檢索,因爲我沒有一個id)。 B)我如何在foreach中從上面實際檢索GUID?
謝謝。