Five Number tools › CAML Query Builder
SharePoint CAML Query Builder
Build a SharePoint CAML query without hand-writing XML. Add Where conditions, choose how they combine, set OrderBy, ViewFields, a row limit and the scope, and get the CAML plus ready-to-run PnP PowerShell, PnP.js, CSOM and REST. The binary And and Or are nested for you.
Everything is built in your browser. Nothing is sent anywhere.
Start from an example
Build the query
Combine with
Output
CAML XML
PnP PowerShell
PnP.js (TypeScript)
CSOM (C#)
REST (GetItems)
CAML notes
- And and Or are binary. This tool nests them for you, so three or more conditions become correctly nested
<And>or<Or>elements. - Field names are internal names, not display names. “Assigned To” is usually
AssignedTo, a space in a name becomes_x0020_. - Value types matter. Pick
DateTime,Number,LookuporUserto match the column, or CAML can return nothing. - Special values: type
[Today],[Today-7],[Now]or[Me]as the value and the tool emits<Today/>,<Today OffsetDays='-7'/>,<Now/>or<UserID/>. - Lookup and people fields: tick
by IDto match on the item ID withLookupId='TRUE'. UseIncludesfor multi-value columns. - In takes several values, comma separated, and becomes a
<Values>list.