I was asked about a “Lazy Approval” for a project in SharePoint.
First let’s define what “Lazy Approval” means: The user should be able to use their mobile phones to approve SharePoint tasks that were spawned by a SharePoint workflow.
Now that being said we have the problem defined, so let’s see the solution that I came up with to solve this problem:
- The workflow processes a task as follow: Create new Task -> while not completed -> Wait for update -> process the properties in principal the outcome -> if completed -> then complete the task.
- A task gets created for a person and the user can edit it to approve/reject
- We can add an event listener on the tasks list and send a special email to the user. the email needs to be less than 1Kb and should contain the instructions on how the approve/reject the item by email. it will also contain an hidden <div id=”LazyApproval”> that contains all the necessary data to identify the task as the URL to the task and maybe the GUID. The ‘from’ field of the email address should contain a special email address.
- Create a library to store the incoming emails from the Lazy Approval. Attach an event receiver to it that will process the messages and update the tasks list with the outcome given by the user. here we can put some validation and if we can’t process the message to update the task we can send another email to the user or a confirmation one when the task got updated.
- Once the task got changed the workflow will see the change and continue.
By using the described approach the user has the choice of approving using SharePoint or by email using the reply button and writing the outcome.
This approach will work with any existing out of the box or custom workflow and is reusable.
There are few issues that needs to be iron out:
- If the task list is used for other task types as review then we need to use a content type for the approver task and attach the event handler to it thus making the solution apply only to a custom workflow that use the custom task content type.
- The user want to see more data other than the task title in the Lazy Approval email.
