I have a CAML
query which retrieves data from a SharePoint
list. It passes for 1 input, but fails when there are 2 or more.
Error:
Microsoft.SharePoint.SPException: One or more field types are not installed properly. Go to the list settings page to delete these fields. ---> System.Runtime.InteropServices.COMException: One or more field types are not installed properly. Go to the list settings page to delete these fields.
After researching, probable cause may be due to mismatch SharePoint column InternalName
. However, query managed to execute for 1 input, but not 2 or more.
Base on the query examples below, am I having a wrong format for the FAIL
cases?
1. PASS:
<Where>
<And>
<Eq>
<FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value>
</Eq>
<Neq>
<FieldRef Name ="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Where>
2. FAIL:
<Where>
<And>
<Eq>
<And>
<Or>
<Eq>
<FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value>
</Eq>
<Eq>
<FieldRef Name="Header1Ref"/><Value Type="Text">H2</Value>
</Eq>
</Or>
<Neq>
<FieldRef Name ="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Eq>
</And>
</Where>
3. FAIL:
<Where>
<And>
<Eq>
<And>
<Or>
<FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value>
<FieldRef Name="Header1Ref"/><Value Type="Text">H2</Value>
</Or>
<Neq>
<FieldRef Name ="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Eq>
<Neq>
<FieldRef Name ="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Where>