Two common mistakes with SPList.GetItems

I wrote a short console application to upload documents as attachments to a list and I ran into two problems that probably cost me 30 minutes today. I’m writing this to remind myself and to save you 30 minutes.


  1. Problem: When I run SPList.GetItems(), it returns the entire list, rather than the items I queried for.
    1. Answer: Are you using the U2U CAML creator to define the CAML syntax for your query (you should be). Be sure that you remove the <Query> tags. If the query returns all of the items, that means your CAML syntax was malformed. The query parameter should start with a <Where> tag.
  2. Problem: When I run SPList.GetItems(), I get the error message that

    One or more field types are not installed properly.

    1. Answer: Are you using the Internal field name? The most common cause of this is not having an _x0020 instead of a space in your field name (eg First_x0020Name instead of First Name)

Leave a Reply

Name *
Email *