SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to search some pages from "Site Pages" Library. Here is my sample code

string q= @"<Where>
                           <FieldRef Name='Name' Ascending='False' />
                           <Value Type='Text'>Home</Value>
  SPQuery query = new SPQuery { Query = q, RowLimit = 1 };      
  SPListItemCollection items = list.GetItems(query);

On executing the above code I get the following error.

"One or more field types are not installed properly. Go to the list settings page to delete these fields."

share|improve this question

I think that 'Name' is just the display name for the field you want to query. You probably need to use the internal name for the field, which is probably something like 'LinkFileName' or 'Title'

share|improve this answer
How can i find the internal name? – V.B Jul 25 '12 at 12:15
With powershell/Microsoft SharePoint Snap-In: $w = get-spweb <webUrl>; $l = $w.Lists["yourlist"]; $f = $l.Fields.GetField("Name"); $f.InternalName. This will give "FileLeafRef". – Matthias Jul 25 '12 at 12:46

You probably have to reference the "Name" field in the ViewFields of the SPQuery object:

query.ViewFields = "<FieldRef Name='Name' />";
share|improve this answer
Thanks for replying but this doesn't work. What I see is there are other columns named as "Name" for "Site Pages" Library.This could be the problem may be. – V.B Jul 25 '12 at 11:45

If you go into the list settings for the list you are trying to query, and hover over the column (in this case 'Name'), you should be able to see the field type for that column.

For example, for the Name column in a SharePoint list, you might see the following:


So you'd use

<FieldRef Name='Title'> 

in your query for that list.

share|improve this answer
For some reason "Name" column is not listed in the list of columns for "Site Pages" – V.B Jul 26 '12 at 5:01
up vote 0 down vote accepted

Atlast I resolved the problem by using internal name for the column "Name" as "FileLeafRef".

Thanks all for your suggestions.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.