Power Automate (Microsoft Flow) – Sending email with version details when a document is created or modified

Hi Friends, in this post, I am gonna walk you through one of the use case scenarios which I heard from my client using Power Automate.

I hope many of you have heard about Power Automate which was named earlier as Microsoft Flow. Those who are not aware of Power Automate, please click here to get some basic knowledge.

The use case is very simple, whenever the user uploads or modified a document to a document library and check-in the finalized version, an email has to be triggered to the author and cc to few users acknowledging the file has been created or modified with version related information. One of the most important requirements is to achieve with low code solution using power automate.

Let us dive into the solution to achieve the same.

  • Configure the document library Versioning Settings to allow ‘Require Check Out‘, so that whenever the user tries to create or modify a document, they have to use the check-in and check-out feature.
  • Next is to configure the flow. Create a flow using ‘When a file is created or modified (properties only)‘ action. Whenever a document is created or modified, the flow will be triggered. Configure the following properties for the trigger action.
    • Site Address
    • Library Name
  • You should not send an email whenever the document is created or modified, you should send only when they checked in the document.
  • To do that add a new step ‘Condition‘ and choose the value ‘CheckedOut‘ from the trigger flow action.
  • When the above value is equal to ‘false‘ the email has to be triggered.
  • On the ‘If yes‘ branch, add an action named ‘Send an HTTP request to SharePoint‘ to retrieve the version information for the document.
    • Site Address
    • Method
    • Uri – Full Path from the trigger action and make sure you give the server relative url of the file
    • Headers
  • Add ‘Send an email notification (V3)‘ action to send an email to the users.
  • The version comments can be achieved using the expression below
              body(‘Send_an_HTTP_request_to_SharePoint)?[‘value’]
  • Thats it so simple is it? your flow is ready to rock and roll.
Happy Coding. Cheers šŸ˜€

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s