在 Microsoft Flow 中等待审批Wait for approval in Microsoft Flow

创建一个流,该流会在用户已在 SharePoint 中创建某个项目的情况下发送审批电子邮件,然后通知用户该项目是被批准还是被拒绝。Create a flow that, if you create an item in SharePoint, sends approval email and then notifies you whether the item was approved or rejected. 若要完全按本教程的说明操作,请创建一个简单的 SharePoint 列表作为触发器操作,但可以使用其他数据源(例如 Dropbox 或 OneDrive)。To follow this tutorial exactly, create a simple SharePoint list as a trigger action, but you can use another data source such as Dropbox or OneDrive.

先决条件Prerequisites

  • 创建一个简单的名为“项目跟踪程序”的 SharePoint 列表,添加名为“标题”的列,然后添加名为“分配到”的“人员”列或“组”列。Create a simple SharePoint list that's named Project Tracker, add a column named Title, and then add a Person or Group column named Assigned To.

    “项目跟踪程序 SPO 列表”的图像

添加一个可触发流的事件Add an event to trigger the flow

  1. 登录到 Microsoft Flow,在顶部导航栏中选择“我的流”,然后选择“从头开始创建”。Sign into Microsoft Flow, select My flows in the top navigation bar, and then select Create from blank.

  2. 选择“搜索数百个连接器和触发器”框,输入新项,然后导航到 SharePoint - 项创建时。Select the Search hundreds of connectors and triggers box, enter new item, and then navigate to SharePoint - when an item is created.

  3. 如果系统提示,请登录到 SharePoint。If prompted, sign into SharePoint.

  4. 在“网站地址”下,输入包含列表的 SharePoint 网站的 URL。Under Site Address, enter the URL of the SharePoint site that contains your list.

  5. 在“列表名称”下,选择之前创建的列表。Under List Name, select the list you created earlier. 如果你是按原步骤操作,则名称为“项目跟踪程序”。If you're following along, the name is Project Tracker.

    SPO 列表名称的图像

添加引发的操作Add the resulting action

  1. 选择“新建步骤”,然后选择“添加操作”。Select the New step button, and then select Add an action.

  2. 在“搜索所有连接器和操作”框中,键入或粘贴“发送电子邮件”,然后选择“Office 365 Outlook - 发送带选项的电子邮件”。In the Search all connectors and actions box, type or paste send email, and then select Office 365 Outlook - Send email with options.

  3. 如果系统提示,请登录到 Office 365 Outlook。If prompted, sign into Office 365 Outlook.

  4. 选择“收件人”字段,然后再选择“分配到电子邮件”令牌。Select the To field, and then select the Assigned to Email token.

    “分配到”列中的用户会收到批准或拒绝该项的电子邮件。The user in the Assigned To column receives the email to approve or reject items. 创建一个用来测试流的项目时,请此字段中指定自己。When you create an item to test the flow, specify yourself in this field. 这样用户不但可以批准或拒绝该项目,而且还可以收到通知电子邮件。That way, you not only approve or reject the item, but also receive the notification email.

    备注

    可以根据需要自定义“主题”字段和“用户选项”字段。You can customize the Subject and User Options fields to suit your needs.

    “将审批电子邮件发送到”字段的图像

添加条件Add a condition

  1. 选择“新建步骤”按钮,然后选择“添加条件”。Select the New step button, and then select Add a condition.

    “添加条件”的图像

  2. 选择第一个框,然后选择“SelectedOption”令牌。Select the first box, and then select the SelectedOption token.

  3. 选择最后一个框,然后键入批准。Select the last box, and then type Approve.

    “条件卡”的图像

  4. 在“如果是”区域中,选择“添加操作”。In the If yes area, select Add an action.

  5. 在“搜索所有连接器和操作”框中,键入或粘贴“发送电子邮件”,然后选择“Office 365 Outlook - 发送电子邮件”。In the Search all connectors and actions box, type or paste send email, and then select Office 365 Outlook - Send an email.

  6. 在“收件人”字段中,输入收件人(例如“通过电子邮件创建”)。In the To field, enter a recipient such as Created by Email.

  7. 在“主题”框中指定主题。In the Subject box, specify a subject.

    例如,可以选择“分配到 DisplayName”,键入“已批准”,两侧各留一空格,然后选择“标题”。For example, select Assigned To DisplayName, type has approved with a space on each side, and then select Title.

  8. 在“正文”框中指定电子邮件正文,例如“准备继续下一阶段的项目。”In the Body box, specify an email body such as Ready to proceed with the next phase of the project.

    备注

    创建了 SharePoint 列表中项目的人将会收到项目被批准或拒绝的通知。The person who created the item in the SharePoint list will be notified whether the project was approved or rejected.

    “是-发送-电子邮件”的图像

  9. 在“如果否”区域中,重复最后五项步骤,区别是更改“主题”和“正文”,反映项目被拒绝这一事实。In the If no area, repeat the last five steps except change the Subject and Body to reflect that the project was rejected.

    “否-发送-电子邮件”的图像

完成并测试流Finish and test your flow

  1. 为流提供一个名称,然后选择“创建流”。Give your flow a name, and then select Create flow.

    “创建-流”的图像

  2. 创建 SharePoint 列表中的项。Create an item in your SharePoint list.

    审批电子邮件发送给指定的收件人。An approval email is sent to the recipient that you specified. 当收件人在该电子邮件中选择“批准”或“拒绝”时,用户会收到指示响应结果的电子邮件。When the recipient selects Approve or Reject in that email, you receive email that indicates the response.

了解详情Learn more