Power Automate - How to search files from a SharePoint document library?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi in this video we will have a look at how to search SharePoint files using power automate okay so this is my document Library called AJ and I have got some files in the root of the directory and I have got a couple of folders then inside inside there is another file called error details.txt and then there is a single folder and then inside that I got to another files also right okay so the first thing I'm going to do is I'm going to search uh the file under the test and one two three four directory called error details Dot txt or I can search portal power Pages Dev process1.png okay so let's take this file then to search so for that what I'm going to do here is I'm going to go to the SharePoint connection and here I'm going to look for get files properties only okay select the site address the library is called AJ and then you know in a normal search a normal filter query what we do is we will look the name and we will say name is equal to this file but for finding the schema name this is a technique you need to use you need to go to the library settings click on the more Library settings then you can see the name it's called the title here yeah so remember that's the name the scheme name is called the title see field is equals title that's where you find the scheme name always okay so let's go back so for that in the filter query I'm going to say title is equal to okay um the file so let me rename this is easy to get the file name like that yeah dot PNG so let's save this flow and search okay I'm going to run the flow so hopefully the filter query should work that's what we think generally that's a filter query generally we use for title is equal to that yeah so what happened here is the flow ran successfully and you can see there is no output here if I click on output see the body value is null there nothing there actually so why why is that so the reason here is for the file Library we can't use the title to you know use as the filter query instead we can use file Leaf rough that's the name you need to use find Leaf rough is equal to such and such and next I'm going to add compose here and let's see what we can get file name with extension whatever we found we can you know get that then again yeah now Let's uh run the flow again all right okay so floor and successfully here we go it found that file now so that's the syntax we need to use a file Leaf rough equals the file name so let's go back to SharePoint under the test under one two three direct one two three four subdirectory I have got another file called error details.txt so let's see what's going to happen there then can I check that so I'm going to do error details Dot txt and run again so this is to level down actually from the root directory so here it is it found that also that's even good news also there so so there is no such uh I don't know what's the maximum level of restriction so uh you know it's working quite well actually in that way as well okay so what happens if I want to search File names contains portal power pages so it this should return one two three then three records so for that what we need to do here is we can't use title contains or anything like that so this syntax again uh you know it's slightly different so what we do here is we are I'm going to say here substring of bracket portal so that's a file name I'm looking for and then I can again say here file leave rough okay let's run this we should get three files there we go one of three then if I open the compose here that's the first file that's the second one click on next that's the third one so that's where you can get so you need to use this now if you want to search you know more than more than one file so suppose you want to search that and you can say or these two here one and two here here so for this we should get 2 actually here it is that's the first one that's the second one I mean again I'm going to say or find Leaf rough is equal to error details Dot txt and I'm going to change this to some other file number there like 200 which is not there actually so I should expect to get this file and this as well and remember this is under the different under a different directory as well not in the root fold a root folder of the document Library okay so let's run this again see there are two here so the first one contains uh one dot PNG and the other one is error to exit find that also so this is the technique we need to use we need to use file Leaf rough okay and if you want to use the uh the matching one then you need to use substring of bracket then the you know what what are the my pattern you want to search with comma fine Leaf rough let's go back to that and put Power Pages there and see whether I can get that there or not so let's see power pages yeah let's run this and see that's going to work there we go it found that there are three files there and again I'm going to use here like some cap cases something like that and see that box yes so here we go so there are three files again here that's one two three right so this is quite powerful actually to find the files you can you you need to use the file Leaf rough you know then along with that you can use uh you know the data filter queries uh with the and or or operator and also for the patterns you need you can use the substring things like that okay so that's end of the video thank you for watching
Info
Channel: abm abm
Views: 23,906
Rating: undefined out of 5
Keywords: Document Library, File Search, Files, Filter Query, Flow, Microsoft, Power Automate, FileLeafRef
Id: G7PspNF6ybc
Channel Id: undefined
Length: 9min 22sec (562 seconds)
Published: Tue Oct 11 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.