Azure Logic Apps for Document Content Approval

Logic Apps is an Azure service for enterprise integration. It comes with many connectors including from outside of the Microsoft ecosystem. In this blog post, I will show an implementation and key implementation points that will facilitate an approval process for approving a document in SharePoint Online.

Business Scenario

  1. User publishes a document for approval.
    LogicAppContentApproval3LogicAppContentApproval1
  2. Assigned approver gets an email to either approve or reject
    LogicAppContentApproval2
  3. Document is set as approved or rejected.
    LogicAppContentApproval3

The business process will be integrating the following three Office 365 services.

  • SharePoint Online – Document Library
  • Office 365 User Profile with Email
  • Outlook

The Logic App Design
LogicAppContentApproval4

Implementation Details

  1. To trigger this Logic App, it done through any modification of the document item properties such as the user action of publishing.
  2. We must get the file metadata of the document specifically the ETag which represents the file version. This is for future use. Note this is not a metadata property.
  3. We must get the files metadata properties such as the approver value. This is for future use.
  4. Get the user profile for the approver to get properties such as job title. This is for future use.
    LogicAppContentApproval5
  5. Send an approval email to the approver along with options for Approve or Reject.
    LogicAppContentApproval6
  6. The approver receives email to click the buttons either Approve or Reject
    LogicAppContentApproval7
  7. Upon an email response from the approver, check the condition if Selected Option is equal to Approve.
    LogicAppContentApproval8
  8. If the condition is true, then we set the document item’s content approval status to ‘Approved’.
    Note a very important parameter is the Etag. We set the ETag retrieved from the Get File Metadata action previously. This is required to know which version of the document is to be set to be approved. If missing, an error in the logic app will be “The ETag of this item does not match the one used for setting content approval status. The contents of the item may have changed before the action was completed”.
    I also use the approver’s Office 365 user profile properties of Display Name and Job Title for the approval comments.
    LogicAppContentApproval9
  9. If the condition is false, we apply the similar configuration where the action is set to Rejected
    LogicAppContentApproval10

As a result of approval, the end user can see the approved status and the approval comments set by the Logic App.

LogicAppContentApproval11

Final Remarks

In contrast to Logic Apps, some readers may ask why not implement in Microsoft Flow where the authoring can be done through SharePoint Online user interface. For this scenario specifically, Microsoft Flow would be more appropriate when the designer has  more of an information worker role. Note that Microsoft Flow is built on top of Logic Apps. And so, consider Logic Apps more for the application developer or even IT. To see a table of differences between Flow and Logic App read Flow vs. Logic Apps. The key advantages with Logic Apps is if this business scenario has needs for greater IT manageability, advanced B2B integration and security management.

One thought on “Azure Logic Apps for Document Content Approval

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 )

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