Power Automate: Use Criteria on OneDrive file names

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone John Day here hope you're well I'm in a my conservatory at the moment which is a bit of a mess I'm converting it into a studio for video and music recordings and productions so apologies for the mess behind me at moment anyway I'm doing some training and moment on power alter fate and power-ups and I'm really really enjoying it there's so much to it but it's still a growing toddler and there are some little features that it could be made simpler for end-users and one in particular is using conditions to search for words in file names or files in onedrive or onedrive for business where I'm showing these tips and tricks in the courses it is consuming time from the content that I'm scheduled to cover so I'm going to put these into video format so that everyone can refer to these as much as they wish so going to give you the lowdown on the dynamic content property we have for getting the phone name from onedrive for business you know identify the limitations and show you how to get around it and plus I'm also going to do a little bit of how to work with searching for content bear in mind that power automate has a case sensitive search facility similar share to get around there okay okay let's get my chunky headphones on and the first thing I'm going to do is do a demonstration using a template there's going to take some files these are my files and they're specifically named for the demonstration and I want to place those files into my onedrive and specifically into a folder called John Day QA there you go so I'm gonna drop them in there I want my flow to take those files and move them into a SharePoint site and into a library called knowledge fault okay let's build that flow so I'm just going to go to the top here and click new and create from template and and there's a lot of templates in there now so when you do look for templates in particular the first thing to concentrate on is to search for the correct data connection so I'm looking at not just onedrive because don't forget there's a free onedrive I want to use the one that's in my onedrive for business so make sure you are connecting to the right data connection otherwise you end up having a flow looking in the wrong place for those files and next thing I want to do is I want to basically connect that to SharePoint so usually just the data connections as search well first tend to narrow down quite quickly the choice of options you've got there and then after that it's going to put in some words like move move file and you can see just by putting those keywords it doesn't make the searching for the template you want a lot easier so I'm now going to click on that one new file from onedrive for business to SharePoint and notify me I've actually don't want the notification but I can delete that so the first thing I do is make sure that my flow can see those data connections that's using used by my user account looks like they're all good click continue now the first thing I do is going to get rid of that notification delete that don't need it okay so let's have a look what we got we've got to trigger at the top there that says when the file is created and that's uploaded or new in my onedrive and in particular I want to let it know that that file is not to be dropped in the root but further in into my John Day QA there we go superb and then it's going to take that file and it's going to create that into SharePoint it's not moving files you can't move a file from one Delta connection to another you have to create it if you if you don't understand that I can do another video on how content is done and furthermore how you need different actions for the content and its metadata you have to sort of bind them together but for now just going to quickly click the drop-down arrow and pick there's my site data mod if actually want the John Day cue a wonder why we're going crazy crazy crazy and then in particular inside there that should now pull up all of my libraries there they are in fact all of my libraries even the ones that are not for users benefit this is my knowledge one and the rest of the content underneath you can see I've got this XMS file name just bring your attention to that XMS file name because it's going to come very important later and then it's going to take the content of my file drop that inside this new file container and then finally when it's finished it's gonna delete the file okay that's that's all ready to go so I'm going to save that and I'm going to just use the back arrow to take this back to the start page off the flow as you can see it's brand-new no runs in there yet so what I'm gonna do is I'm now just going to go back to my onedrive and I'm going to take one of these files and I'll take the manage teams user guide and drop down okay so all about do you now go back to my power automate tab and click the refresh button here on the side just to wait for that to run the flow now Microsoft do say there's a policy of up to five minutes on an enterprise license or an academic license up to five no more than a maximum of five minutes that you'd normally have to wait for that run to appear so let's see from now how many minutes it takes let's just keep clicking refresh until that appears yeah no joy yet nope still waiting [Music] [Applause] [Music] [Applause] [Music] [Music] [Applause] [Music] [Music] right okay so it's it's done the flow ran a minute ago let's have a look and see if it's happened so I'm gonna go into onedrive files gone go into my SharePoint library files arrived brilliant happened a few seconds ago that's actually not true if I go and refresh the page that actually happened why it's now two minutes ago okay good stuff so it works so the next stage is to only move the files that contain the word user guide so I'm hoping by the end of this is that I only get three of those files move I saw I've got three with the word user guide one without and that's the idea I want it to move those three files but leave the other one behind so so I'm gonna go back to the flow and I'm going to edit it okay so what want to do now is create in between that trigger and that first create file action would like to insert a new action and this is gonna be a control type of action so in particular I want to condition there okay so the condition is to see if the file name contains the words user guide and then if it does what I'd like to do is then only then if it's true is create the file in SharePoint and then delete it from the onedrive for business so I've just dragged and dropped those files into the yes box great or got you now it's the condition so I'm gonna click in there and as you saw earlier I had that file name which I click on this one here there it is and I'm just gonna hover over it and you'll notice this is one as XMS file name encoded encoded not Xmas file name you know extra stuff on name encoder but she's a bit kind of weird ok one's going to carry on so if that file name contains and then I'm going to put in the words user guide now I could do it like that so it's looking for it as a user space guide I could if I wanted to get really clever add the row and say if the file name contains user and the file name contains guide it doesn't matter I mean that will just mean that if I put the words next to each other or if they're in different places then then that would still work I actually want it to be the phrase user guide so what I'm gonna do is I'm just going to delete the extra row and leave it as it was user guide okay brilliant and if that's true saves the file into SharePoint and then deletes it from the onedrive ok brilliant so I'm going to save this flow and I'm gonna go back to the start page and didn't I try it again so I want to do is I'm going to delete it from here we'll do the exactly the same file delete it I'm gonna use that exact same file that I did which is the amenities manage teams user guide and just drop that back into onedrive ok where we go she's gonna go back to my power to mate and run that flow again just wait for it to run okay so it's run yeah and it's successful it says it succeeded which means I go to one drive and find the files are there so must clear this up little bit confused does it run succeeded didn't fail and what he means by that is if I click on the date for this run all the actions successfully ran and it checked when a file was dropped in it checked to see if the file contained the condition and it said it didn't so it successfully went down the yes side and said but I'm not going to run those it went down the no side instead but because of nothing in there nothing to run so it successfully succeeded but yet it didn't move the file even though it contains the words user guide so the file I was looking for was called manage teams user guide okay dot docx now it said in that field encoded now if it was like and encoded as we see in your ELLs where you have that the percentage 20 that means it doesn't like spaces so it turns into a like a hexadecimal code to zero that I could manage I could deal with that because it would still work but that's not actually what the encoded is in flow that is the encoded file name and it's got no user guide in that whatsoever so the problem is is looking for that field and I need to find a way of grabbing that one so I have to take that field name this is encoded and replace it with one that doesn't have encoded like I saw in the original template in fact like I saw here so I'm gonna get rid of that the shame of it is there is no unencoded copy in here how do I get it so if I go to the expression what I would like to be able to do is grab that field place it in there and then remove the - encoded bit only problem is I mean the expression I've clicked in it and when I click back on the dynamic content I can't I can't even put it in there this is a little trick I want to show you and it simply is when you go to the expression tab click inside the expression box press the spacebar once and that triggers it to say I'm building an expression so now I want to go back to the dynamic content I can scroll down select the file name and it places it into the expression as I want to use it great I just want to get rid of that space now that I put in there so I'm gonna remove that space now I can move to the right hand side of this and remove that - encoded-word that's it for click okay job done now it's because it is a modified expression it comes up like a limo gent or a pink color that will fix itself later I'm rather that it's just reminding me that I've modified that myself manually so I'm gonna save this flow great I'm gonna go back to the start page of this flow and I want to oh haha gotta wait another X amount of minutes to start that file actually no I don't see the great thing about it is that flow did succeed but it didn't move the file and I went in there and edited the reason why it didn't work but what I can do with a flow is I can actually where where it's possible is I can then run this test button in the top right corner here and what it allows me to do is allow me to rerun using a previous run so machinist say go and tree trigger the run that I did seven minutes ago I'll click test and that will actually go and pick up that that file in onedrive but it runs it immediately I'm gonna wait for X amount of minutes up to a maximum of five it's run if I go to onedrive now there it is it's gone it's gone if I go to SharePoint there it is it's arrived so it has now worked it's now taken that user guide word looked for the actual file name not the encoded one and moved the file now every time a run is listed in this list I can click the date as you saw earlier but I can also expand each trigger and each action and look at the outputs and just to show that was the actual file name that the action was looking for and that was the one that was causing the problem because I have no user guide word in there so that's why I changed it I sort of tweaked the field and got rid of the - encoded and that allowed me to look for the file name that I see okay so what that means is with all four of these files the first three should be moved because they all contain the word user guide and the bottom one should stay in my onedrive location so let's try them out let's go and have a look so I'm going to take all of those files I don't know drop them all in at the same time so that'd be one flow run per file so back to my flow start page and I'm going to so it's not always that bad look at that background within seconds I'm not kidding that ran straight away so okay let's have a look in onedrive oh well oh well the intro to microsoft forms is still there because it hasn't got the user guides but the other these two is still sitting there hang on which one doesn't move then well it's the same one that I had before the manage teams user guide has moved why didn't those other too far was move so these are the four files that I was attempting in the flow I was expecting the first three to work but only the first one worked the reason for this is because the criterion flow is case-sensitive the first one worked because it matches the upper case G and u in user guide the second file has a lower case G the third one has got a lowercase U and G so therefore they didn't match I need to find a way of getting it to look for the text but not the casing of the text the best way to do this is to take those file names just tweak them borrow them and convert them to either uppercase or lowercase so I'm going to convert mine to a lowercase format and that way my criteria will be matched in that same casing now I'm not permanently changing the file names in any way I'm just extracting the file names and then converting them to lowercase and that will then bring back the correct results I'm looking for so let's go and edit this flow again and I need to expand the condition and I'm going to focus on first of all this m/s file name and I'm gonna remove it I'm gonna write it all again so you can see it nice and cleanly built so I'm gonna get rid of that I'm gonna build the expression again but I need to convert that field to lowercase now if you know Excel you might be aware of certain functions use is worth having a look for those functions because they have some have very similar names so you can see that where I'm looking for the lower function in Excel is actually called to lower in here so I'm going to select that one it's good now if you can't find the function looking for there's a whole range of function names and I'll put a link to all of the expressional functions into the video so you can see that now these are like Excel functions and that means that to place all of the arguments all the information the function needs to do its job inside brackets so when I do that the brackets pop up and it automate put sort of text box on screen to give me the information I need to make this work so I need to just basically put in the text that I'm converting to lower want to get rid of that pop up you'll see ultimately puts the closed bracket in for you so we'll go do now is either type or I'm gonna cheat I'm gonna go back to the dynamic content find that file name push it in there and then like I did before I'm going to go to the end and get rid of the - encoded I don't the encoded file name I want the regular file name click OK okay and the last thing I have to do is take the value that I'm looking for and make sure that is in the matching lower case okay so that's job done I'm now gonna save my float and I'm just going to I'm not going to do all the testing and the rerun I'm gonna do this properly I want to make sure that those are fresh set files in there I don't want to make sure this actually runs properly so when I go to my onedrive and I want to drop those files in there they are just drop them in ok and then wait for them to go into flow and then wait for flow to run and see if those actually work now through the power of video you don't have to wait for that I do though [Music] okay so those files have run again just gonna confirm they've run I'm gonna go to my onedrive three files have gone one stay behind go to the SharePoint there the three files that contain user guide whether they are uppercase or lowercase oh great now I'm just going to look at the all runs because I say if I did this demonstrating training this is worst case scenario fifty minutes I think the longest it's taken me to do that one demo so I hope you've had some information out of this I hope you've got some good tips and tricks and again I encourage you to come to my channel and come to Facebook come to LinkedIn come to Twitter ask me questions ask me there's any videos you'd like me to do I will put them in there for you or do my very very best otherwise a safe I hope you've enjoyed this hope it's been worthwhile watching stay safe and have fun [Music] [Music] [Applause] [Music] [Applause] [Music] you [Music]
Info
Channel: John Day Q&A
Views: 1,406
Rating: 5 out of 5
Keywords: Office, 365, Power, Automate, Expression, File, name, search, criteria, doe, snot, work, issue, trouble, problem, cannot, help, Manage, encoded
Id: fq-JPMPMP-g
Channel Id: undefined
Length: 23min 35sec (1415 seconds)
Published: Tue Mar 10 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.