Posts

Showing posts with the label Power Automate

Power Automate: Rename file in SharePoint Online

Image
  We often get to change the name of the file, so in this article, I will explain how to rename the file in SharePoint Online using Microsoft Power Automate. Below is the file which I will be renaming. Step 1: Get the file properties We only need to have the SharePoint item id, for which we want to rename the file Step 2: Update the File Name Add the "Send an HTTP request to SharePoint" connector, and update the following properties Method : POST Uri : _api/web/lists/GetByTitle(' <LIBRARY TITLE> ')/items( <ITEM ID> )/ValidateUpdateListItem Body: {     "formValues" :[         {             "FieldName" : "FileLeafRef" ,             "FieldValue" : "<New File Name>"         }     ] } Execute the flow, and the file will be renamed Happy Automating..!! #PowerAutomate #SharePointWidgets #Microsoft

Power Automate Tip: Reduce loop to improve performace

Image
  If you are creating very complex flows using Microsoft PowerAutomate which contains loops ( Apply To Each connector), you must have noticed that performance degrades sharply.  I had a loop of 120 items with some complex business logic, which was taking around 40 mins to execute the complete flow. But after I have removed the loops and reduced the number of variables now flow gets completed in less than 8 mins. So you can imagine the performance if your flow is going to be executed on a very large dataset. To improve the performance of the flow, it's necessary to reduce the loop count and to do that  I count on the 2 best functions from Power Automate. To explain the below functions, I will take a scenario where there are below fields  Title City State #1: Select You can make use of the Select function to create a collection/array of single-valued or complex objects, even without looping each item. Case 1:  Suppose I want to collect all the cities from all the...

Power Automate Tip: How to define constants without having too many variabled declared

Image
  I have been architecting things and came to my observation that developers are using too many of the variables in the flow which they want to keep the hard-coded values or technically say constants. Declaring/initializing too many variables makes the flow very big and becomes hard to understand. Moreover, it takes a lot of time and effort to add the number of variable components and to name and add comments. This tip will save you from all of these. So for a quick tip on how we can declare the constants more effectively so that we are not filling the whole screen with the variable declaration So to do it we can make use of 2 connectors Compose Parse JSON For example, if you want to hardcode the Site URL and some of the list Names we can do something like this... Step 1: Compose Step 2: Parse JSON Step 3: Usage Conclusion So these 2 steps will save a lot of your time and effort which you spent in adding the variable connector and defining them. If you want to update any property a...

Rename Folder using Microsoft Flow / Power Automate in a Document Library in SharePoint Online

Image
Hi Friends, Today blog is about renaming the folder in the document library using the MS FLOW or MS Power Automate. When I started working on this it seems to be an easy job, but if you look into the connectors you'll find it really difficult as there is no straight forwards connector to do the job. Issues encountered If you try using the " Get Folder Metadata " connector, you'll not be able to get the ID of the folder as it is returning as the negative value. If you get the ID somehow and try to update the folder name using the " Update File Properties " connector, you'll end up renaming only the title of the folder, but it will still have the old name as the display name which in case is again a failure. There is no other connector which can be utilized to achieve the task of renaming the folder in a document library directly. Solution The solution is a simple three-step (at least in this example). Step 1: Initialize variables In case you are computing...