Tuesday, September 15, 2009

Internal names should be used in SPQuery

Today I found out an interesting issue when I accidentally changed a field name used in a query used in SPQuery.

I wanted to change the display names of my fields and after doing that I renamed all the usages of that field name in my web part code.

After deploying the solution I got the error message "One or more field types are not installed properly. Go to the list settings page to delete these fields"

I had no clue what so ever when you read that error message.This is not the only error message that share point generates which we cannot figure out by looking at this.

I spent considerable amount of time debugging the solution until I decided to Google the error message.

Then found that in one of the msdn forums that the internal names of the fields should be used in the CAML queries.

reference : http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/a2c6bed0-eee1-4f9b-b468-fc57c2e45c16

And that was indeed the trick.

No comments: