Setup an alert when a file is edited on OneDrive

Photo by Scott Graham on Unsplash

When you share the file from your One Drive with external users, often is to collaborate during the lifecycle of the document. There are some scenarios where you may want to know when that file is edited. So we have PowerAutomate where you can create a Flow to detect these changes. However, there are some tricks that you need to use in order to detect these changes.

The PowerAutomate flow works with changes on the folders, which forces you to create a folder for the project but if you have 2 or more files inside that folder, it’ll always trigger the flow and send you an email saying the file was changed.

On our example, we’ve placed a file on the root of One Drive and give it of Testing PowerAutomate.docx and that’s the file that we need to receive notifications when there is a change.

  1. Create an Automated flow and find the One Drive.
  2. Select the trigger When a file is Modified and select the folder where the file is located.
  3. Now add a Condition action
    1. Select File Name and put it is equal to
    2. Here is the trick, the file comes encoded so we need to decode it in order to have the correct name.
    3. Click on Add dynamic content and select the expression base64 as shown.
      • base64(‘Testing PowerAutomate.docx’)
  4. From here you get this alert from multiple options, Microsoft Teams, Notification 365, Email. On our scenario, we will use email so search for Send Email.
  5. Select the Office 365 connected and send the email as you want.

Conclusion

With this little change on your PowerAutomate, you can have alerts set up on your PowerAumate for the files that are really important to be aware of the change or to know if someone edits then.

4 Comments

  1. Jitendra Singh said:

    I need to trigger a flow when any file in folder is modified . I used a trigger ” when file is modified” but it triggers when file is created as well when file is modified.
    I don’t need trigger when file is created , i need trgger only when file is modified.
    Kindly suggest

    April 9, 2021
    Reply
  2. Virgiliu A. said:

    Hello David,

    Thank you for your article, is perfect for me !
    The problem is that when I modified once in the file, every 5 to 20 minutes is sent an alert that the file has been modified. The alert is not stop even if no modification were made on file.
    Is there any solution for receive the alert only once ?

    Thank you !

    August 10, 2021
    Reply
    • David Ramalho said:

      Hey,

      That’s a nice catch. I would say yes but only for when you edit the file. So on the flow trigger put something like
      @not(@contains(triggerOutputs()?['body/Editor/DisplayName'], ‘Megan Brower’))

      My best,
      David Ramalho

      October 21, 2021
      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *