Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top