Skip to content

Commit 7299e89

Browse files
authored
Merge branch 'master' into jackwi-alt-manage-list-flows
2 parents 4df54a8 + ca5fba3 commit 7299e89

38 files changed

+142
-43
lines changed

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,6 @@ You can also tweet / follow [@Microsoft365Dev](https://twitter.com/Microsoft365D
7272
* [Setup your Machine](https://docs.microsoft.com/sharepoint/dev/spfx/set-up-your-development-environment)
7373
* [Go build your first web part](https://docs.microsoft.com/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part)
7474

75-
## Reference
76-
* [sp-application-base](https://docs.microsoft.com/javascript/api/sp-application-base)
77-
* [sp-component-base](https://docs.microsoft.com/javascript/api/sp-component-base)
78-
* [sp-core-library](https://docs.microsoft.com/javascript/api/sp-core-library)
79-
* [sp-dialog](https://docs.microsoft.com/javascript/api/sp-dialog)
80-
* [sp-extension-base](https://docs.microsoft.com/javascript/api/sp-extension-base)
81-
* [sp-http](https://docs.microsoft.com/javascript/api/sp-http)
82-
* [sp-listview-extensibility](https://docs.microsoft.com/javascript/api/sp-listview-extensibility)
83-
* [sp-odata-types](https://docs.microsoft.com/javascript/api/sp-odata-types)
84-
* [sp-page-context](https://docs.microsoft.com/javascript/api/sp-page-context)
85-
* [sp-webpart-base](https://docs.microsoft.com/javascript/api/sp-webpart-base)
8675

8776
## Learn More
8877

@@ -109,6 +98,14 @@ The SharePoint Framework is now generally available at Office 365.
10998

11099
- [SharePoint Framework reaches general availability—build and deploy engaging web parts today](https://blogs.office.com/2017/02/23/sharepoint-framework-reaches-general-availability-build-and-deploy-engaging-web-parts-today/)
111100

101+
## Contribute on the SharePoint Dev Docs
102+
103+
Please see following guidance if you are planning to submit changes on the SharePoint developer documentation. We do welcome your pull requests!
104+
105+
* [Contribution guidance](https://github.com/SharePoint/sp-dev-docs/blob/master/.github/CONTRIBUTING.md)
106+
* [How to Create Good Pull Requests](https://github.com/SharePoint/sp-dev-docs/wiki/How-to-Create-Good-Pull-Requests)
107+
* If you are a Microsoft contributor, please review official guidance from our [internal documentation](https://review.docs.microsoft.com/en-us/help/contribute/?branch=master) for docs.microsoft.com contributors
108+
112109
## Have Fun
113110

114111
We look forward to seeing what you build! Please tweet us at @Microsoft365Dev, @m365pnp or @SharePoint with the #SPFx tag!
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

0 commit comments

Comments
 (0)