Filter by Formula in Sharepoint node

Hello,

Describe the problem/error/question

I want to search some Sharepoint folders.
When I ask whthout any filter, it works :

When I try to filter with “Filter by formula”, it does not work anymore.
Some filter examples I tried :

image

image

What is the error message (if any)?

Please share your workflow

No workflow, only this node

Share the output returned by the last node

Error code 400

Information on your n8n setup

Item Index
0
Run Index
0
Node type
n8n-nodes-base.microsoftSharePoint
Node version
1 (Latest)
n8n version
1.118.1 (Self Hosted)

Thank you !

Hey there,

I really looked into this issue, and eventually created an Azure account, registered an app etc. But along the way I got stuck because of some authorization issues. However I still read the Graph documentation, here is what I found:

  • Apparently contains is a function, not an operator. So the correct usage would be contains(fields/Title, 'For') or contains(file/Name, 'For').
  • n8n gives a default example fields/Title eq 'item1' but eqhere is an operator, so it is different than the contains() function.
  • There is also some examples in the official Sharepoint documentation.

However… I got a headache so I stopped :pensive_face: . Hope this helps though.

Hello @Moo ,

Thank you for you clues.

It doesn’t work (if I well-understood what you said). As per example, you can see what I can have when I do not type any filter :

but, when I try a filter, I have an error :

contains(field/LinkFilename, ‘Formations’)

Best regards

try contains(flelds/FileLeafRef, 'For')or fields/FileLeafRef eq '30 - Formations') for specific files.

I also read about FileLeafRef, didn’t mention it here tough, tought past ones would work. These must solve your issue. Keep in mind that eq means equals so you might need to write the exact same name when using it.

There is a progress. The error is still here but this is not the same message !
The field seams to be not searchable.

How to knows which ones are searchable and which ones not ?

It worked actually, just that FileLeafReffield isn’t indexed, so it returns this error. This is how Sharepoint protects slow queries if the list is too big. You have a couple of solutions:

→ Go to Sharepoint Dashboard, Settings, Columns, and add FileLeafRefas indexed column.
→ Use an HTTP Request node instead, and add a header(Prefer) with this value in your request: HonorNonIndexedQueriesWarningMayFailRandomly.
→ You can also send a GET request to this url: https://{tenant}.sharepoint.com/sites/{site}/_api/web/lists/getbytitle('YourList')/fields?$select=Title,InternalName,Indexed,Filterable,Sortable,Queryable to retrieve fields that you can use in your filter.

But, adding the FileLeafRef as indexed column seems easier so I recommend doing so.

1 Like

The column is not listed as indexable.

It seams better with HTTP request.

The conclusion is that we must not using native Sharepoint n8n nodes…

Thank you for your help !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.