CAML Query Builder
Build SharePoint CAML queries visually without writing raw XML.
How to Use the CAML Query Builder
The CAML Query Builder generates valid Collaborative Application Markup Language (CAML) XML for querying SharePoint list and library items. CAML is required when using CSOM, JSOM, REST API renderListDataAsStream, or SharePoint legacy APIs that do not support OData filtering natively.
Add view fields to control which columns are returned. Use WHERE conditions with operators like Eq, Contains, or Lt to filter results. Choose the AND/OR logical operator to combine multiple conditions. Set a row limit to control result count and avoid throttling on large lists.
CAML vs OData
CAML is SharePoint-native and supports features that OData $filter does not, such as DateRangesOverlap for recurring calendar items, MemberOf for audience targeting, and cross-list lookups. Use CAML when working with SharePoint Framework web parts via PnPjs or the legacy SP.ClientContext JavaScript API.
Understanding Operators
- Eq / Neq — Exact equality and inequality. Works with Text, Number, and Lookup types.
- Gt / Geq / Lt / Leq — Greater than / less than comparisons. Use with Number and DateTime types.
- Contains / BeginsWith — Partial string matching. Only valid for Text and Choice columns.
- IsNull / IsNotNull — Check for empty or non-empty values. No Value element needed.
- DateRangesOverlap — Used for recurring calendar event queries.
Multiple Conditions (Binary Tree)
CAML requires conditions to be nested as a binary tree when more than two are used. This tool automatically wraps three or more conditions into the correct nested <And> or <Or> structure so your queries are always valid XML.