cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

How to create flow When OneDrive edit send notify only once time

 

Hi,

 

I'm new to flow and I'm trying to get a file update notification(Excel File) on mail.

So I sat flow as follows:

1. Trigger - OneDrive - "When modified File" - Target Folder

2. Action - OneDrive - Create Share Link - Target File ID

3. Action - Gmail - "Send Email"

 

But that trigger detect every character edit on Excel.

So I've received 10 mail though I just edited a little bit!

 

As my own hope, 

I'd like to send email on edit action, some latitude in editing time as like 60min.

The simplest way to do this, trigger on every 60 min. check file same it as ever was, if it changed detected, send email.

But there is not trigger of schedule only action.

 

So, what I should do to receive notify after some editing, not every editing?

 

Thank you in advance for any help.

 
7 REPLIES 7
Super User III
Super User III

Try this.....

 

Below is a screen shot of a Flow designed to be run once an hour (it ran successfully for me).

 

When the flow starts, I subtract 1 hour from the current time.and store it in a string variable

Then I get the file metatdata

After that, I compare the modified time to the time stored in the variable.

If the file has been modified in the last hour, an email is sent.

 

Yo'll need to edit the condition in advanced mode - here is the formula I used:

@greaterOrEquals(body('Get_file_metadata_using_path')?['LastModified'], variables('OneHourAgo'))

 

Please post here if this needs more explanation.  

If this solves your problem, please post here.

 

SendEmailOnFileChange1.jpg

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Thanks to reply, ScottShearer!

 

But I can't set "Action - Initialize Variable" because I couldn't see cleary your screenshot...

Would you post configration about "Initialize Variable" in text ?

(Especially, "Expression" section)

I'm sorry to cause you trouble.

Here is the expression that I used in the initialize Variable action:

 

subtractFromTime(utcNow(),1,'Hour')
 
Recur.jpg
 
Just ask if you need more help.
 
Scott
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Community Support
Community Support

Hi @pws-nks,

 

I agree with @ScottShearer's thought almost, I assume that you want to check if the Excel file is changed in the last 1 hour, if yes, send the email notification.

 

You could also take a try with the following workaround:

  • Add a Recurrence trigger, Interval set to 1 and Frequency set to Hour. 
  • Add a "Get file metadata using path" action, specify File Path.
  • Add a Condition, click "Edit in advanced mode", type the following formula:
@greaterOrEquals(formatDateTime(addHours(body('Get_file_metadata_using_path')?['LastModified'], 1), 'yyyy-MM-ddTHH:mm:ssZ'), utcNow('yyyy-MM-ddTHH:mm:ssZ'))
  • Within "If/yes" branch of Condition, add a "Send an email" action.

Image reference:28.JPG

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello, @pws-nks!

 

Have you had a chance to apply @v-xida-msft ‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

 

Thank you for being an active member of the Flow Community!

 

-Gabriel

(Flow Community Admin)

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager
Power Platform Communities

I know this is a bit of an old thread now, but is there a way to do this for a whole folder rather than having to edit in each file?

 

I have a folder which I update each week with a new file and don't want to have to create a new flow for all of them

@CM123:

 

You could change the examples above a bit by using one of the OneDrive for Business list or Find files actions and loop through each one.  The Flow would still run using a recurrence trigger.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (11,549)