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.
- User publishes a document for approval.
- Assigned approver gets an email to either approve or reject
- Document is set as approved or rejected.
The business process will be integrating the following three Office 365 services.
- SharePoint Online – Document Library
- Office 365 User Profile with Email
The Logic App Design
- To trigger this Logic App, it done through any modification of the document item properties such as the user action of publishing.
- 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.
- We must get the files metadata properties such as the approver value. This is for future use.
- Get the user profile for the approver to get properties such as job title. This is for future use.
- Send an approval email to the approver along with options for Approve or Reject.
- The approver receives email to click the buttons either Approve or Reject
- Upon an email response from the approver, check the condition if Selected Option is equal to Approve.
- 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.
- If the condition is false, we apply the similar configuration where the action is set to Rejected
As a result of approval, the end user can see the approved status and the approval comments set by the Logic App.
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”
Reblogged this on The Flying Maverick.