我在想如何在早期綁定中使用LINQ
獲得選項集字段的標籤CRM 2011
。在LINQ中獲取選項集標籤
我試過使用FormattedValues["field_name"]
但我得到了以下錯誤The given key was not present in the dictionary
。
var query = (from username in context.SystemUserSet
select new { username.FullName,
Manager = (username.ParentSystemUserId == null) ? string.Empty : username.ParentSystemUserId.Name,
DepartmentValue = username.new_Department,
Department = username.FormattedValues["new_Department"] ,
username.SystemUserId });
在此先感謝。
小寫字母是否解決了您的問題? – Daryl
不,我仍然有相同的錯誤信息 – user3881480
您是否檢查過FormattedValues集合中的哪些字段?我只用它與查詢表達式,所以你可以嘗試新建一個新的SystemUser,而不是創建一個新的類型,並看看你是否可以訪問它的價值。 – Daryl