Forum Discussion
CAML Query with two conditions not working
- Nov 15, 2019
Hi Frank,
Not sure which version of SharePoint you are usingQuery looks OK for me ,AND condition wont work.
Make sure you use OR condition,However we can design the CAML Query using the UI Tools or google with CAML Query Builder /CAML Designer
here is the link
https://www.biwug.be/resources
I hope this works for Sharepoint online too,just check it.
Hi Frank,
Not sure which version of SharePoint you are usingQuery looks OK for me ,AND condition wont work.
Make sure you use OR condition,However we can design the CAML Query using the UI Tools or google with CAML Query Builder /CAML Designer
here is the link
https://www.biwug.be/resources
I hope this works for Sharepoint online too,just check it.
Hi O365Developer The "Or" did the trick. Thanks a lot. I am happy happy
- miler4199Sep 25, 2020Copper Contributor
I have also been trying to get a CAML query functioning in SharePoint online.
1. In addition to the CAML code, do you need any other code inserted into the web part to get the query to work?
2. What web part are you using? I see a "content query" web part as an option. Is this where you insert the code, and then it would apply to the list on that page?
Thanks.
- Frank NielsenSep 26, 2020Copper Contributor
Hi miler4199 I am using a highlited webpart in Sharepoint Online Modern, and the trick with changing the And to Or did the magic. The CQWP is located in the old versions of SharePoint, and I am trying to keep up with the modern design.
/Frank
- miler4199Sep 28, 2020Copper Contributor
Frank Nielsen Thanks. I just realized that CAML queries appear to be valid for SharePoint libraries, but not for lists. There was an option to select a document library, but not a list.