views:

1694

answers:

2

In SP2007/MOSS I need to run a CAML query against a single list like so:

<Where>
    <Or>
        <Eq>
            <FieldRef Name='URL' />
            <Value Type='URL'>/path/item1.aspx</Value>
        </Eq>
        <Eq>
            <FieldRef Name='URL' />
            <Value Type='URL'>/path/item4.aspx</Value>
        </Eq>
        <Eq>
            <FieldRef Name='URL' />
            <Value Type='URL'>/path/item7.aspx</Value>
        </Eq>
    </Or>
</Where>

The practical outcome of this would be that I have a SPListItemCollection of the items for which I had the URLs.

However, I am getting an error 'One or more field types are not installed properly. Go to the list settings page to delete these fields.'

All of the items in the list are of the same content type. The only relevant error in the SP logs shows the same message.

The answer did not solve this specific problem but did end up being correct (Or's have to be nested). The problem was that my field Value Type should have been FileRef.

A: 

Does your list have multiple content types?

Does the list have items with one a content type of the same name, but created a different times? (the item will retain the old content type in many cases of content type changes)

Sometimes fields with the same name will be stored in different database columns. Though I would not have thought so for a single list.

What is does the sharepoint log have to say?

Nat
+2  A: 

This error is almost always because your CAML query is incorrect. Have you tried formatting it like this:

<Where>
    <Or>
        <Eq>
            <FieldRef Name='URL' />
            <Value Type='URL'>/path/item1.aspx</Value>
        </Eq>
        <Or>
            <Eq>
                <FieldRef Name='URL' />
                <Value Type='URL'>/path/item4.aspx</Value>
            </Eq>
            <Eq>
                <FieldRef Name='URL' />
                <Value Type='URL'>/path/item7.aspx</Value>
            </Eq>
        </Or>
    </Or>
</Where>

I'm pretty sure you can only have two components in an Or or And branch.

Alex Angas