Forum Discussion

Erik Wettergren's avatar
Erik Wettergren
Iron Contributor
Apr 30, 2019
Solved

How to use MS FLow and ODATA to filter a document library on file name?

Hi, I'm trying to filter a SharePoint document library using ODATA in the Get Items action in Flow. I can for example use the ODATA expression startswith(Title,'abc') to make it filter on the Title column, but if I do the same with the Name column. i.e. startswith(Name,'abc') stating the Name column doesn't exist.

 

How come? And is there a way around this?

  • Erik Wettergren 

     

    Erik,

     

    Instead of using name as the filter, try FileLeafRef -

     

    I was able to return all files from this library whose names start with the letter H.

     

    Hope this helps.

     

    Terry McCullagh

10 Replies

  • Erik Wettergren 

     

    Erik,

     

    Instead of using name as the filter, try FileLeafRef -

     

    I was able to return all files from this library whose names start with the letter H.

     

    Hope this helps.

     

    Terry McCullagh

    • Erik Wettergren's avatar
      Erik Wettergren
      Iron Contributor

      By the way, tried to do a similar operation using substringof instead of startswith. Oddly though this didn't work unless I switched places of the FileLeafRef variable and the substring to filter on.

       

       

    • Erik Wettergren's avatar
      Erik Wettergren
      Iron Contributor

      It certainly helps!

      Just out of curiosity - how did you figure this one out? From the SharePoint Search Schema?

       

      Thank you!

      • Terry_McCullagh's avatar
        Terry_McCullagh
        Brass Contributor

        Erik Wettergren 

         

        Erik,

         

        I've found the Odata Query Builder from Authur Graus to be extremely helpful in constructing the correct queries.

        https://appsource.microsoft.com/en-us/product/office/WA104051159

         

        This article is also helpful:

        https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests

         

        Regards,

         

        Terry

Resources