Skip to content

Filtering data sources with SharePoint OData

The SharePoint query settings let you choose which data SharePoint returns to Team Forms. The query builder creates the OData query for you, so you do not need to write an OData expression.

SharePoint queries are available for SharePoint list and form-submission data sources with either User access or Managed access. They apply to every form using the source, including public forms with public form access enabled.

  1. Open the team’s Data Sources and create or edit a SharePoint list or form-submission source.
  2. Select the underlying list or form, then open Advanced settings → SharePoint query.
  3. For a SharePoint list, choose Columns to limit the fields available to forms. Leave it empty to include all available columns, or select up to 100 columns. Include fields used by display templates, calculations, and other form logic.
  4. Turn on Filter rows, choose a Column, and enter a condition using the available operator and value controls.
  5. Use Add condition for up to five conditions on the same column. Choose All conditions to require every condition or Any condition to accept any of them.
  6. Optionally turn on Sort rows, choose a column, and select Ascending or Descending.
  7. Select Done or use the back arrow to return to the data source settings. Team Forms tests the query before leaving the panel. Resolve any test error, then select Save data source.

If a separate Preview environment is configured, the query is tested against both the primary and preview sources. Changing the query or source configuration requires it to be tested again before saving.

The available operators depend on the selected column’s type.

Column typeOperators
TextEquals, Does not equal, Starts with
ChoiceEquals, Does not equal
NumberEquals, Does not equal, Less than, Less than or equal, Greater than, Greater than or equal
DateEquals, Does not equal, Before, On or before, After, On or after
Yes/NoEquals, Does not equal

For example, to load only Ferrari vehicles, enable Filter rows, choose your Make column, select Equals, and enter Ferrari.

To include two makes, add another condition on Make with Equals and Porsche, then choose Any condition. To select a numeric range, choose All conditions with Greater than or equal and Less than or equal on the same number column.

The builder supports one filter column and one sort column. Filter values are fixed in the data source settings. For a drop-down that changes based on another answer, use component filtering or cascading drop-downs after the source has loaded.

For SharePoint list sources, turn on Expand fields to include display values for lookup and person columns instead of only their SharePoint IDs. Up to 12 lookup or person fields can be expanded. If the option is unavailable because there are too many, select fewer fields under Columns.

Form-submission sources provide filtering and sorting, but do not show the Columns or Expand fields controls.

Prefer columns marked Indexed for filtering and sorting. If you select an unindexed column, Team Forms warns you and asks SharePoint to run the query anyway. A query that works now may fail as the list grows or changes. Index the relevant column in SharePoint for more reliable queries.

If SharePoint query test failed appears, read the error, check the selected columns and values, and verify access to both the primary and preview sources. For managed access, check the Microsoft connection in Data access. Select Done or use the back arrow to test the corrected query again.

SettingWhen it runsEffect
Data source SharePoint queryOn SharePoint, before records are loaded.Limits source rows and columns and sets their initial order for all forms using the source.
Component Filter QueryIn the browser, after the source is loaded.Controls which options appear in that component and can use current form answers.

A component cannot restore rows or columns excluded by the source query. Component sorting can change the order shown in a drop-down. For public forms, restrict the source query to data visitors may access; hiding options in a component does not prevent the underlying source data from reaching the browser.