cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
personalcompute
Frequent Visitor

Send file share link via SMTP mail when a file is created in OneDrive

I'm new to Power Automate and I can't figure this out. What I'm trying to do is:

 

A) When a file is created in OneDrive folder, a share link is created. 

B) Depending on which folder the new file was created, send the file share link via SMTP mail to different receipients.

 

The issues I'm facing are:

1) My folder in OneDrive is not recognised as folder but as file. When I create an OneDrive step, my folder doesn't show up in that step in [ *Folder -> Show Picker ] but it is available in [ *File -> Show Picker ].

2) How do I pass the share link for this newly created file to be used in mail in latter step? 

3) I'm using [ Switch ] to differentiate folder path with the intention stated in B). As I test my flow, the Case was not triggered because the folder path obtained in the [ Switch ] step was some random characters eg. ahGRD5kJFD and the folder path I specified in [ Case -> *Equals ] is /Root/New Folder

 

 

 

8 REPLIES 8
ekarim2020
Super User
Super User

You will need something like this logic:

ekarim2020_0-1625574836934.png

 

ekarim2020
Super User
Super User

For the folder path:

ekarim2020_2-1625575564214.png

You will see this because the file path is encoded to base64:

ekarim2020_0-1625575490058.png

Use an expression to see the file folder path by using decodeBase64(FilePath)

 

 

decodeBase64(triggerOutputs()?['headers/x-ms-file-path-encoded'])

 

 

ekarim2020_3-1625575615473.png
This returns the file path as human readable:
ekarim2020_1-1625575523415.png

 

Ellis

Thank you. Using the Substring funstion, I was able to extract only the folder path. 

Thank you. It works smoothly. Do you have any idea why one of my folder is not listed in the first step [When a file is created -> *Folder ]? 

ekarim2020
Super User
Super User

>>>Do you have any idea why one of my folder is not listed in the first step [When a file is created -> *Folder ]?

Can you send a screenshot of the trigger action:

ekarim2020_0-1625646976938.png

In the example above, any file created within the Books folder or any subfolders under Books should trigger the flow.

ekarim2020_1-1625647231218.png

There are some constraints: Files larger than 50 MB will be skipped and not returned by this trigger. Files moved within OneDrive are not considered new files.

 

See:  OneDrive for Business When a file is created

 

Ellis

File DirectoryFile Directory

 

The folder I'm intended to use is "Kimeda". 

 

Folder shown in StepFolder shown in Step

 

The folder "Kimeda" is not shown in the Step's Picker. 

 

I tried using other Step previously, couldn't remember what was the Step name, "Kimeda" was available in the Picker but the icon beside it was "File icon" instead of "Folder icon" as shown. 

ekarim2020
Super User
Super User

In File Explorer, what status icons are shown for the folder:

ekarim2020_0-1625733176256.png

Are there any documents within the Kimeda folder?

Another test:  close the flow, re-name the folder to Kimeda1, wait and allow the change to sync, then edit the flow again and see if the folder Kimeda1 appears as a selectable folder.

Ellis

 

Capture.PNG

 

That folder contains few sub folders and documents. The total folder size is over 50MB.

However the Step trigger is to create a file no larger than 50MB within that folder, so maybe there's a limit to folder size as well?

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,633)