設定與 PowerApps、Microsoft Flow 及 Power BI 整合的 SharePoint Online 清單Set up lists for SharePoint Online integration with PowerApps, Microsoft Flow, and Power BI

注意:這篇文章是搭配 SharePoint Online 使用 PowerApps、Microsoft Flow 及 Power BI 之教學課程系列的一部分。Note: 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 值:新硬體、升級硬體、新軟體、升級軟體Values: new hardware, upgraded hardware, new software, upgraded software
RequestDateRequestDate 日期Date
要求者Requestor 單行文字Single line of text
EstimatedDaysEstimatedDays 數字Number 可以比較要求者估計與專案經理估計Enables comparison of requestor estimate to project manager estimate to actual
已核准Approved 單行文字Single line of text 值:擱置、是、否Values: pending, yes, no

注意:我們也會使用 [識別碼] 資料行,這是由 SharePoint 產生,且預設隱藏。Note: We also use the ID column, which is generated by SharePoint and hidden by default. 我們為了簡單起見而使用基本資料類型,但是實際應用程式可能會使用更複雜的類型,例如針對 [要求者] 資料行使用 [個人或群組]。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 連線至 SharePointFor 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 數字Number 比對 [專案要求] 清單 [識別碼] 資料行中的值Matches the value in the Project Requests list ID column
ApprovedDateApprovedDate 日期Date
狀態Status 單行文字Single line of text 值:未啟動、進行中、完成Values: not started, in progress, completed
ProjectedStartDateProjectedStartDate 日期Date 專案經理估計專案將會啟動的日期When the project manager estimates that the project will start
ProjectedEndDateProjectedEndDate 日期Date 專案經理估計專案將會結束的日期When the project manager estimates that the project will end
ProjectedDaysProjectedDays 數字Number 通常會計算工作天數,但是此案例中並非如此Working days; would typically be calculated, but isn't in this scenario
ActualDaysActualDays 數字Number 針對已完成專案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。Note: 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.

    指定新的清單名稱

    專案要求清單隨即建立,具有預設 [標題] 欄位。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. 輸入名稱「描述」,然後按一下或點選 [建立]。Enter the name "Description", then click or tap Create.

    建立描述資料行

  3. 針對清單中的其他資料行重複步驟1Repeat steps 1. 2and 2. for the other columns in the list:

    1. 單行文字 > "ProjectType"Single line of text > "ProjectType"
    2. 日期 > "RequestDate"Date > "RequestDate"
    3. 單行文字 > "Requestor"Single line of text > "Requestor"
    4. 數字 > "EstimatedDays"Number > "EstimatedDays"
    5. 單行文字 > "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 中開啟 project-management-app.msappOpen project-management-app.msapp in PowerApps Studio.
  2. 按一下或點選 [允許],讓 PowerApps 可以使用 SharePoint。Click or tap Allow, so that PowerApps can use SharePoint.
  3. 在功能區的 [檢視] 索引標籤上,按一下或點選 [資料來源]。On the ribbon, on the View tab, click or tap Data sources.

    PowerApps 資料來源

  4. 在右窗格中,按一下或點選 [專案詳細資料] 旁邊省略符號 (...),然後按一下或點選 [移除]。In the right pane, click or tap the ellipsis (. . .) next to Project Details, then click or tap Remove.

    移除專案詳細資料資料來源

  5. 在右窗格中,按一下或點選 [新增資料來源]。In the right pane, click or tap Add Data Source.

    新增資料來源

  6. 按一下或點選 [新增連接]。Click or tap New connection.

    新增連接

  7. 按一下或點選 SharePoint,然後按一下或點選 [連線]。Click or tap SharePoint, then Connect.

    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 sources tab in the right pane now shows the connection that you created.

    資料來源

  10. 在右窗格中,按一下或點選 [專案詳細資料] 旁邊省略符號 (...),然後按一下或點選 [重新整理]。In the right pane, 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 connections work properly.
  12. 使用 [專案要求] 清單,針對 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.pbixOpen 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.

    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. 登入組織帳戶 (您用來存取 SharePoint Online 的帳戶),然後按一下或點選 [連線]。Sign in with an organizational 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.