Flow / Power Automate - Manipulate Dynamic Content with Power FX Tutorial

Learn to automate file renaming in OneDrive for Business using Power FX functions. Create a flow to handle dynamic content, store file details, and apply a specific naming convention. Utilize variables, Power FX date and time functions, and predefined actions to achieve seamless renaming. Watch as the file is automatically renamed according to the desired convention, providing an efficient and fully operational flow.

  • 03:59
  • 6 views
00:00:04
we will see how to handle dynamic content using power FX functions.
00:00:08
This flow will automate the renaming of a file
00:00:10
uploaded to onedrive according to the following naming convention,
00:00:14
user's name, month, year of the file and file name. In lower case,
00:00:20
let's dive into the details by creating a new flow using onedrive for business.
00:00:26
Be careful not to select one drive alone which refers to a personal drive
00:00:30
here. It is specifically onedrive for business.
00:00:36
For this tutorial,
00:00:37
we will limit the renaming process to a folder in
00:00:40
the drive named training folder and its sub folders.
00:00:44
Utilizing the advanced options
00:00:47
include sub folders
00:00:50
and also set a maximum delay of one minute for the trigger
00:00:54
to manipulate the information of your file.
00:00:58
Add the get file metadata action which allows access to more details
00:01:02
about the file which we will refer to here by its ID.
00:01:07
For the following actions related to the
00:01:09
manipulations tied to the defined naming convention.
00:01:12
You will need to use variables to store the outcome of these processes,
00:01:15
initialize your first variable which will retrieve the month
00:01:19
and year associated with the modification of your file
00:01:23
name. This variable and set its type to text.
00:01:26
Take this opportunity to rename the block for clarity.
00:01:30
Then use the power FX functions,
00:01:34
particularly those from the date and time category.
00:01:37
The format date time function will allow you to apply a specific format by using
00:01:42
the dynamic content related to the modification date
00:01:45
of your file extracted from the metadata.
00:01:48
Conclude by adding the desired date, format, month year,
00:01:55
directly proceed with creating your second variable.
00:01:58
Also of text type which will store the folder path for renaming.
00:02:01
This is specific here because it is possible to retrieve the path of a onedrive file.
00:02:06
However, the path also includes the file name, you wish to rename.
00:02:10
Therefore you need to remove the file name from the
00:02:13
path to keep only the folder where this file is stored
00:02:17
to do this, use the replace function which starting from the complete path
00:02:23
should find the file name alone retrievable through the
00:02:26
display name content which only returns the file name,
00:02:30
replace it with an empty string.
00:02:32
Your variable will thus return the folder path without the file name
00:02:38
before renaming.
00:02:39
Go through an intermediate step aimed at constructing the final name of your file.
00:02:44
Use the predefined compose action which you populate
00:02:48
in order with the variable containing the folder path.
00:02:52
The name of the user who modified or created the file, the month year date, variable
00:02:58
lastly convert the file name to lowercase using the power FX to lower function.
00:03:07
You only need to finalize the renaming action by
00:03:10
finding the corresponding one drive for business action,
00:03:17
specify the id of the concerned file and use the path property with the content
00:03:22
of your compose action containing both the
00:03:24
target folder and the desired naming convention.
00:03:27
If a file with the same name already exists, you can as in this case, replace it,
00:03:34
save and test. Now
00:03:37
in the concerned folder within your onedrive, create an Excel file.
00:03:40
For example, with a random name in uppercase and wait
00:03:46
the flow executes correctly,
00:03:49
check the folder.
00:03:51
Perfect. The file has been automatically renamed.
00:03:53
According to the desired naming convention,
00:03:56
your flow is fully operational.

No elements match your search in this video....
Do another search or back to content !

 

DiLeaP AI: THIS MIGHT BE HELPFUL

Reminder

Show