创建列表以便将 SharePoint Online 与 PowerApps、Microsoft Flow 和 Power BI 集成Set up lists for SharePoint Online integration with PowerApps, Microsoft Flow, and Power BI

备注

本文属于介绍如何将 PowerApps、Microsoft Flow 和 Power BI 与 SharePoint Online 结合使用的系列教程。This article is part of a tutorial series on using PowerApps, Microsoft Flow, and Power BI with SharePoint Online. 请确保已阅读系列介绍,了解总体情况以及相关下载内容。Make sure you read the series introduction to get a sense of the big picture, as well as related downloads.

SharePoint 具有大量共享和协作功能,但对于此方案,我们将重点关注其中一种功能,即 SharePoint 列表SharePoint has a ton of features for sharing and collaboration, but we will focus on one feature for this scenario: SharePoint lists. 列表就是一系列可以与团队成员和其他网站用户共享的数据。A list is just a collection of data that you can share with team members and other site users. 我们将回顾一下用于此方案的列表,以便你可以在自己的 SharePoint Online 网站中创建列表。We'll review the lists used for this scenario, then you can create them in your own SharePoint Online site.

第 1 步:了解列表Step 1: Understand the lists

第一个列表是便于项目申请者添加申请的“项目申请”列表。The first list is Project Requests, where a project requestor adds a request. 然后,项目审批者可以审查申请,并决定是批准还是拒绝。The project approver then reviews the request and approves or rejects it.

列表列List Column 数据类型Data Type 备注Notes
标题Title 单行文本Single line of text 默认列,用于项目名称Default column, used for project name
说明Description 单行文本Single line of text
ProjectTypeProjectType 单行文本Single line of text 值:new hardware、upgraded hardware、new software、upgraded softwareValues: new hardware, upgraded hardware, new software, upgraded software
RequestDateRequestDate DateDate
RequestorRequestor 单行文本Single line of text
EstimatedDaysEstimatedDays NumberNumber 将申请者的预计天数与项目经理的预计天数以及实际天数进行比较Enables comparison of requestor estimate to project manager estimate to actual
ApprovedApproved 单行文本Single line of text 值:pending、yes、noValues: pending, yes, no

备注

还使用由 SharePoint 生成且默认隐藏的“ID”列。We also use the ID column, which is generated by SharePoint and hidden by default. 为简单起见,我们使用基本的数据类型,但实际应用可能会使用更为复杂的类型,如“Requestor”列的“Person or Group”类型。We use basic data types for simplicity, but a real app might use more complex types, like Person or Group for the Requestor column. 若要了解 PowerApps 支持的数据类型,请参阅从 Microsoft PowerApps 到 SharePoint 的连接For information on data types supported by PowerApps, see Connect from Microsoft PowerApps to SharePoint.

第二个列表是“项目详细信息”列表,用于跟踪所有已获准项目的详细信息,如已分配的项目经理。The second list is Project Details, which tracks details for all approved projects, like which project manager is assigned.

列表列List Column 数据类型Data Type 备注Notes
标题Title 单行文本Single line of text 默认列,用于项目名称Default column, used for project name
RequestIDRequestID NumberNumber 与“项目申请”列表中“ID”列的值一致Matches the value in the Project Requests list ID column
ApprovedDateApprovedDate DateDate
状态Status 单行文本Single line of text 值:not started、in progress、completedValues: not started, in progress, completed
ProjectedStartDateProjectedStartDate DateDate 项目经理预计的项目开始时间When the project manager estimates that the project will start
ProjectedEndDateProjectedEndDate DateDate 项目经理预计的项目结束时间When the project manager estimates that the project will end
ProjectedDaysProjectedDays NumberNumber 工作天数;通常会进行计算,但此方案例外Working days; would typically be calculated, but isn't in this scenario
ActualDaysActualDays NumberNumber 对于已完成的项目For completed projects
PMAssignedPMAssigned 单行文本Single line of text 项目经理Project manager

第 2 步:创建并检查列表Step 2: Create and review the lists

若要继续完成此方案,需要创建两个 SharePoint 列表,并在其中填充示例数据。To continue with the scenario, you need to create the two SharePoint lists and populate them with sample data. 为此,我们将介绍如何创建列表,并在其中粘贴示例数据。We'll show you how to do this by creating the list and pasting sample data into it. 请确保已从下载包获取 Excel 文件。Make sure you have the Excel files from the download package.

备注

在这一步中,使用 Internet Explorer。Use Internet Explorer for this step.

创建列表Create the lists

  1. 在 Internet Explorer 中,依次单击或点击 SharePoint 网站上的“新建”和“列表”。In Internet Explorer, in your SharePoint site, click or tap New, then List.

    新建 SharePoint 列表

  2. 输入名称“项目申请”,再单击或点击“创建”。Enter the name "Project Requests", then click or tap Create.

    指定新列表的名称

    此时,将创建“项目申请”列表,其中包含默认“Title”字段。The Project Requests list is created, with the default Title field.

    “项目申请”列表

向列表添加列Add columns to the list

  1. 依次单击或点击 “新建项”图标 和“单行文本”。Click or tap New item icon, then Single line of text.

    添加单行文本字段

  2. 输入名称“Description”,再单击或点击“保存”。Enter the name "Description", then click or tap Save.

  3. 对列表中的其他列重复执行第 1 步Repeat steps 1. 和第 2 步and 2. for the other columns in the list:

    1. “Single line of text”>“ProjectType”Single line of text > "ProjectType"
    2. “Date”>“RequestDate”Date > "RequestDate"
    3. “Single line of text”>“Requestor”Single line of text > "Requestor"
    4. “Number”>“EstimatedDays”Number > "EstimatedDays"
    5. “Single line of text”>“Approved”Single line of text > "Approved"

将数据复制到列表中Copy data into the list

  1. 单击或点击“快速编辑”。Click or tap Quick edit.

    适用于列表的“快速编辑”

  2. 选择网格中的单元格。Select the cells in the grid.

    包含所有列的列表

  3. 打开 project-requests.xlsx 工作簿,并选择所有数据(不含标题)。Open the project-requests.xlsx workbook and select all the data (not the headings).

    “项目申请”Excel 表

  4. 将数据复制并粘贴到 SharePoint 内的网格中,再单击或点击“完成”。Copy the data and paste it into the grid in SharePoint, then click or tap Done.

    包含数据的已完成列表

  5. 使用 project-details.xlsx 工作簿,对“项目详细信息”列表重复执行列表创建和复制过程。Repeat the list creation and copy process for the "Project Details" list, using the project-details.xlsx workbook. 请参阅第 1 步:了解列表中的“项目详细信息”表,了解列名称和数据类型。Refer to the Project Details table in Step 1: Understand the lists for the column names and data types.

第 3 步:为示例内容更新连接 - 可选Step 3: Update connections to samples - optional

正如本系列教程简介部分中所述,我们在下载包中添加了两个示例应用和一个报表。As noted in the introduction to this tutorial series, we included two sample apps and a report in the download package. 可以在不使用这些示例的情况下完成此方案,但若要使用示例,必须更新与 SharePoint 列表的连接。You can complete this scenario without using these samples, but if you want to use the samples, you need to update the connections to the SharePoint lists. 更新为使用你自己的列表(而不是我们的列表)作为数据源。You update them so that they use your lists as a data source, rather than ours.

为示例应用更新连接Update connections for the sample apps

  1. PowerApps Studio,单击或点击打开的左窗格中。In PowerApps Studio, click or tap Open in the left pane.

  2. 单击或点击“浏览”,再打开下载的“project-management-app.msapp”文件。Click or tap Browse, then open the project-management-app.msapp file that you downloaded.

  3. 单击或点击“允许”,以便 PowerApps 可以使用 SharePoint。Click or tap Allow, so that PowerApps can use SharePoint.

  4. 在功能区中的“视图”选项卡上,单击或点击“数据源”。On the ribbon, on the View tab, click or tap Data sources.

    PowerApps 数据源

  5. 在“数据”面板中,依次单击或点击“项目详细信息”旁边的省略号 (...) 和“删除”。In the Data panel, click or tap the ellipsis (. . .) next to Project Details, then click or tap Remove.

    删除“项目详细信息”数据源

  6. 单击或点击“添加数据源”。Click or tap Add Data Source.

    添加数据源

  7. 接下来,将介绍两种连接到列表的方式,具体取决于 PowerApps 是否已建立 SharePoint 连接:We'll show you two ways to connect to the list, depending on whether PowerApps already established a SharePoint connection for you:

    • 如果已看到 SharePoint 连接,请单击或点击此连接。If you see a SharePoint connection already, click or tap that connection.

      现有连接

    • 如果看不到 SharePoint 连接,请单击或点击“新建连接”。If you don't see a SharePoint connection, click or tap New connection.

      新建连接

      然后,依次单击或点击“SharePoint”和“创建”。Then click or tap SharePoint, and click or tap Create.

      SharePoint 连接

  8. 输入包含你创建的列表的 SharePoint Online 网站 URL,再单击或点击“前往”。Enter the URL for the SharePoint Online site that contains the lists you created, then click or tap Go.

    SharePoint URL

  9. 选择“项目详细信息”列表,再单击或点击“连接”。Select the Project Details list, then click or tap Connect.

    “项目详细信息”列表

    此时,“数据”面板显示所创建的连接。The Data panel now shows the connection that you created.

    数据源

  10. 依次单击或点击“项目详细信息”旁边的省略号 (...) 和“刷新”。Click or tap the ellipsis (. . .) next to Project Details, then click or tap Refresh.

    刷新“项目详细信息”数据源

  11. 单击右上角的 Click “运行应用”图标 以运行应用,并确保连接有效。in the upper right corner to run the app, and make sure the connection works properly.

  12. 单击或点击“文件”,再将应用保存到云中。Click or tap File, then save the app to the cloud.

  13. 使用“项目申请”列表,对“project-requests-app.msapp”重复执行此部分中的步骤。Repeat the steps in this section for project-requests-app.msapp, using the Project Requests list.

为示例报表更新连接Update connections for the sample report

  1. 在 Power BI Desktop 中打开“project-analysis.pbix”。Open project-analysis.pbix in Power BI Desktop.

  2. 在功能区的“开始”选项卡上,依次单击或点击“编辑查询”和“数据源设置”。On the ribbon, on the Home tab, click or tap Edit queries, then Data source settings.

    编辑查询

  3. 单击或点击“更改源”。Click or tap Change Source.

    数据源设置

  4. 输入 SharePoint Online 网站 URL,再依次单击或点击“确定”和“关闭”。Enter the URL for your SharePoint Online site, then click or tap OK, then Close.

    SharePoint 列表 URL

  5. 此时,Power BI Desktop 在功能区下显示横幅,以便可以应用更改并导入新源中的数据。Power BI Desktop displays a banner under the ribbon, so you can apply changes and bring in data from the new source. 单击或点击“应用更改”。Click or tap Apply Changes.

    应用查询更改

  6. 使用 Microsoft 帐户(用于访问 SharePoint Online 的帐户)登录,再单击或点击“连接”。Sign in with a Microsoft account (the account you use to access SharePoint Online), then click or tap Connect.

    连接 SharePoint Online

后续步骤Next steps

本系列教程的下一步是生成用于处理项目申请的应用The next step in this tutorial series is to generate an app to handle project requests.