Five Number tools
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, Lookup or User to 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 ID to match on the item ID with LookupId='TRUE'. Use Includes for multi-value columns.
  • In takes several values, comma separated, and becomes a <Values> list.

Disclaimer

These tools are provided free and as-is, with no warranty of any kind. Results are best-effort and can be incomplete or out of date, so always verify them against official Microsoft documentation before you act on them.

fivenumber tools is an independent project and is not affiliated with, sponsored by, or endorsed by Microsoft. Microsoft, Microsoft 365, SharePoint, Entra, OneDrive and Copilot are trademarks of the Microsoft group of companies.

Send feedback

Found this useful, or hit a snag? Tell me what worked and what would make it better. Your note comes straight to me.

Thanks, your feedback was sent.

I read every note. If you left your email, I may follow up.