Sunday 26 February 2012

One or more field types are not installed properly. Go to the list settings page to delete these fields in executing CAML queries

Hi,

An issues was reported to me where a developer was trying to use a  CAML query and was getting this error:
"One or more field types are not installed properly. Go to the list settings page to delete these fields". I checked the fields and they fine I executed few other queries and found that they were working fine. This was a clear indication that there was something wrong in the query rather than in the list settings. I found that the query had a column "Approval Status". To verify if it is causing the issue or not I executed  a small piece of code to get the internal name and I found that the internal name of this field is "_ModerationStatus". I changed the value in the query and it worked fine.

I am sharing this so that it will be helpful for someone facing this. I am attaching a small piece of code for reference


SPQuery query = new SPQuery();
                String camlQuery = "<Where><Eq><FieldRef Name='_ModerationStatus'/><Value Type='Text'>Pending</Value></Eq></Where>";
                query.Query = camlQuery;
                SPListItemCollection items = list.GetItems(query);

I hope this will help you out.

No comments:

Post a Comment