SPException – One or more field types are not installed properly. Go to the…
Sharepoint developers often face the following exception while querying a custom list or document library using SPQuery.
for example, I’ve got this exception in the following code snippet,
string lname = memberLeaveAccount[“LoginName”].ToString();
int chrIndex = lname.IndexOf(“#”);
if (chrIndex >= 0)
lname = lname.Substring(chrIndex + 1);
SPQuery spQuery = new SPQuery();
spQuery.Query = “<Where><Eq><FieldRef Name=’Account‘></FieldRef> <Value Type=’Text’>” + lname + “</Value></Eq></Where>”;
SPListItemCollection EmployeeRecord = MyCustomList.GetItems(spQuery);
string gender = string.Empty;
//If an employee record is removed from custom list, just move to next record.
if (EmployeeRecord == null)
if (EmployeeRecord != null && EmployeeRecord.Count == 0)
I’ve got the exception at ‘EmployeeRecord.Count’. I’ve found that, the field name ‘Account’ is only the Display Name and the internal name is “AccountName”. So, after giving the correct internal name, the SPQuery worked fine.
NOTE: To get the fields (in custom list or document library) Internal Name,
foreach(SPField field in MyCustomList.Fields)
No comments yet.