Skip to content

Commit ca5fba3

Browse files
authored
Merge pull request SharePoint#5774 from SharePoint/jackwi-alt-require-doc-approval
Review complete and fixed all pending issues. Merging this change with the master.
2 parents b3092fc + 2856ffa commit ca5fba3

20 files changed

+102
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
title: Require approval of documents in SharePoint using Power Automate
3+
ms.date: 05/19/2020
4+
---
5+
6+
# Require approval of documents in SharePoint using Power Automate
7+
8+
Documents that contain sensitive information often require approvals. With the content approval feature in SharePoint, you can put a simple approval process for documents in a specific document library. Using this content approval process, documents pending approval will not be visible to users until they are approved.
9+
10+
Manage the content approval settings in the library settings page:
11+
12+
![Content approval settings](../../../images/setup-content-approval-settings.png)
13+
14+
Settings > Versioning settings > Require content approval for submitted items
15+
16+
After this setting is enabled, when users upload documents to this specific library, the document’s **Approval Status** is either in:
17+
18+
- **Draft** (if minor and major versions are enabled) or
19+
- **Pending** (if only the major version is enabled) state
20+
21+
You can always visit the document library to approve and reject documents but this exercise is tedious. It requires receiving notifications about the pending document(s), finding the appropriate document(s) for approval, then identifying approvers, and finally generating the command to approve/reject the document(s).
22+
23+
Alternatively, why not automate this approval process using a flow?
24+
25+
## Content approval flow in Power Automate
26+
27+
You can automate this entire content approval process using an approval flow. When approved, the content approval status of the document is automatically set to **Approved**; if rejected, the flow sets the content approval status of the document to **Rejected**.
28+
29+
To set the content approval status of the document, with the SharePoint connector, use the **Set content approval status** action in the flow.
30+
31+
The following actions occur:
32+
33+
1. Power Automate uses a SharePoint *trigger* when a new file is added to the library.
34+
1. *Get file metadata* provides the *ETag* property (along with many others) required when dealing with content approvals.
35+
- ETag is a special identifier that identifies the specific version of that item pending approval.
36+
1. Start an approval action:
37+
- Include people for approving the documents.
38+
- Approvers should be either **Site Owners** or **Site Members**.
39+
- If you are managing users in SharePoint groups, make sure approvers are part of the **Design** permission-level group.
40+
1. If approval response is approved:
41+
- Set content approval status of the document to **Approved**.
42+
- Send an email to the document author regarding the approval along with any comments.
43+
1. If approval response is not approved:
44+
- Set content approval status of the document to **Rejected**.
45+
- Send an email to the document author regarding the rejection along with any comments.
46+
47+
## Setting up the flow in Power Automate
48+
49+
Using the following template, create a flow in Power Automate.
50+
51+
1. In the SharePoint library, from the command bar, select **Automate** > **Power Automate** > **Create a flow**.
52+
1. Next, select the template: **When a new file is added in SharePoint, complete a custom action**.
53+
54+
![File add custom action](../../../images/create-flow-template-file-added.png)
55+
56+
1. Add the actions as described in the previous steps.
57+
58+
![Flow content approval full](../../../images/flow-content-approval-full.png)
59+
60+
## Set content approval status action
61+
62+
The content approval action requires the following entries:
63+
64+
- SharePoint site
65+
- Library name
66+
- Identifier of the item (in this case, the document ID)
67+
- Content approval action
68+
- Comments
69+
70+
To see the *ETag*, expand **Show advanced options**.
71+
72+
> [!NOTE]
73+
> While the content approval action help says that ETag is optional, it is required for documents and pages while it may be optional for list items.
74+
75+
![Content approval status Approve](../../../images/action-content-approval-status.png)
76+
77+
You must ensure you enter the correct site and library name. However, you can get the rest of the values from the previous actions in the flow.
78+
79+
- Identifier
80+
- Using the *Id* property from the *trigger output*
81+
- Comments
82+
- Using the *comments* property from the *approval response*
83+
- ETAG
84+
- Using the *ETag* property from the *Get file metadata* action output
85+
86+
You can now use the content approval status action to approve and reject the document based on the approval response.
87+
88+
The end result is that:
89+
90+
1. After the flow is triggered, approvers get an email to approve/reject the document with the document link.
91+
1. Approvers can now:
92+
- If your email client supports Outlook-actionable messages: Approve it within the email using actionable messages if your Outlook client supports it.
93+
- If your email client does not support Outlook-actionable messages: Select **Approve** or **Reject** that takes you to Power Automate site where you can approve or reject the document.
94+
1. After approval or rejection:
95+
- Document creator receives an email with the approval status along with the approval comments.
96+
97+
![Email approval status](../../../images/output-content-approval-status.png)
98+
99+
This is an effective way to automate document approval in SharePoint using Power Automate! Use this procedure for list items and pages as well.
100+
68.9 KB
Loading
77.9 KB
Loading
Loading

docs/images/contribute-clone-icon.png

778 Bytes
Loading
-36.4 KB
Loading
1.98 KB
Loading
-31.8 KB
Loading
-27.6 KB
Loading
Loading

0 commit comments

Comments
 (0)