We have a SharePoint list of items where we would like to filter on a specific field (i.e. EMail = [email protected]) to create a list of entries. We are getting 400 errors saying invalid filter expression.
This is our list schema:
Query, where we are selecting columns FirstName (PRD First Name), Title (PRD Last Name), BRK Name (BRK_x0020_Name), and Email (E-Mail), and then filtering to where the Email equals [email protected]:
public ListItemCollectionPage getRecipients(){
LinkedList<Option> requestOptions = new LinkedList<>();
requestOptions.add(new QueryOption("expand", "fields(select=FirstName,Title,BRK_x0020_Name,EMail)"));
requestOptions.add(new QueryOption("$filter", "eq(EMail,'[email protected]')"));
ListItemCollectionRequest listRequest = graphServiceClient.sites(graphConfig.getSiteId()).lists(graphConfig.getListId()).items()
.buildRequest(requestOptions);
System.out.println(listRequest.getRequestUrl());
return listRequest.get();
}
The URL generated is:
https://graph.microsoft.com/v1.0/sites/{side-id}/lists/{list-id}/items?expand=fields%28select%3DFirstName%2CTitle%2CBRK_x0020_Name%2CEMail%29&%24filter=eq%28EMail%2C%27sample%40microsoft.com%27%29
Stack trace:
com.microsoft.graph.http.GraphServiceException: Error code: BadRequest
Error message: Invalid filter clause
400 : Bad Request
[...]
[Some information was truncated for brevity, enable debug logging for more details]
at com.microsoft.graph.http.GraphServiceException.createFromResponse(GraphServiceException.java:419) ~[microsoft-graph-core-2.0.14.jar:na]
at com.microsoft.graph.http.GraphServiceException.createFromResponse(GraphServiceException.java:378) ~[microsoft-graph-core-2.0.14.jar:na]
at com.microsoft.graph.http.CoreHttpProvider.handleErrorResponse(CoreHttpProvider.java:512) ~[microsoft-graph-core-2.0.14.jar:na]
What exactly is invalid about this request?
