在 PowerApps 中新增資料連線Add a data connection in PowerApps

在 PowerApps 中,對現有的應用程式或您從頭開始建置的應用程式新增資料連線。In PowerApps, add a data connection to an existing app or to an app that you're building from scratch. 本主題中您使用 PowerApps Studio,但也可以如管理連線主題所述使用 powerapps.comIn this topic, you use PowerApps Studio, but you can also use powerapps.com, as the Manage connections topic describes.

應用程式的資料連線可以連線至 SharePoint、Salesforce、OneDrive 或其中一個其他資料來源Your app's data connection can connect to SharePoint, Salesforce, OneDrive, or one of many other data sources.

在本文之後的下一步是在您的應用程式中顯示和管理來自資料來源的資料,如下列範例所示:Your next step after this article is to display and manage data from that data source in your app, as in these examples:

  • 連線到 OneDrive,然後在您的應用程式中管理 Excel 活頁簿中的資料。Connect to OneDrive, and manage data in an Excel workbook in your app.
  • 連線至 Twilio,然後從您的應用程式傳送簡訊。Connect to Twilio, and send an SMS message from your app.
  • 連線至 SQL Server,並從您的應用程式更新資料表。Connect to SQL Server, and update a table from your app.

必要條件Prerequisites

註冊 PowerApps、加以安裝、予以開啟,然後以您註冊時所使用的認證登入。Sign up for PowerApps, install it, open it, and then sign in by providing the same credentials that you used to sign up.

資料連線的背景介紹Background on data connections

大部分的 PowerApps 應用程式使用稱為資料來源的外部資訊,可儲存於雲端服務中。Most PowerApps apps use external information called Data Sources that is stored in cloud services. 常見範例是儲存在商務用 OneDrive 中的 Excel 檔案資料表。A common example is a table in an Excel file stored in OneDrive for Business. 應用程式可以使用「連接器」,以存取這些資料來源。Apps are able to access these data sources by using Connectors.

最常見的資料來源是資料表,您可以使用它來擷取與儲存資訊。The most common data sources are tables, which you can use to retrieve and store information. 您可以使用資料來源的連接器來讀取與寫入 Microsoft Excel 活頁簿、SharePoint 清單、SQL 資料表,以及許多其他格式中的資料,這些都可以儲存在像是商務用 OneDrive、DropBox、SQL Server 等等的雲端服務中。You can use connectors to data sources to read and write data in Microsoft Excel workbooks, SharePoint lists, SQL tables, and many other formats, which can be stored in cloud services such as OneDrive for Business, DropBox, SQL Server, etc.

資料表以外的資料來源包括電子郵件、行事曆、Twitter 和通知。Data sources other than tables include email, calendars, Twitter, and notifications.

使用資源庫顯示表單編輯表單控制項,可以輕鬆地建立從資料來源讀取與寫入資料的應用程式。Using the Gallery, Display form, and Edit form controls, it's easy to create an app that reads and writes data from a data source. 若要開始,請參閱資料表單一文。To get started, read the article Understand data forms.

新增連線Add a connection

  1. 按一下或點選 [檔案] 功能表 (靠近左側邊緣) 中的 [新增]。Click or tap New on the File menu (near the left edge).

    檔案功能表上的新增選項

  2. 在 [空白應用程式] 磚上,按一下或點選 [手機配置]。On the Blank app tile, click or tap Phone layout .

    從頭建立應用程式

  3. 在中央窗格,按一下或點選 [連線至資料]。In the center pane, click or tap connect to data.

  4. 如果 [資料] 窗格中的連線清單包含您想要使用的連線,請按一下或點選該連線以將它新增至應用程式。If the list of connections in the Data pane includes the one that you want, click or tap it to add it to the app. 否則,請跳至下一個步驟。Otherwise, skip to the next step.

    新增資料來源

  5. 按一下或點選 [新增連接] 以顯示連接器清單。Click or tap New connection to display a list of connectors.

    新增連線

  6. 捲動整個連接器清單,直到您想要建立的連線類型出現 (例如,Office 365 Outlook),然後按一下或點選它。Scroll through the list of connectors until the type of connection that you want to create appears (for example, Office 365 Outlook), and then click or tap it.

    選擇連線

  7. 按一下或點選 [建立] 以建立連線並將它新增至您的應用程式。Click or tap Create to both create the connection and add it to your app.

    某些連接器 (例如 Microsoft Translator) 不需要其他步驟,您就可以立即顯示其資料。Some connectors, such as Microsoft Translator, require no additional steps, and you can show data from them immediately. 其他的連接器會提示您提供認證、指定一組特定的資料,或執行其他步驟。Other connectors prompt you to provide credentials, specify a particular set of data, or perform other steps. 例如,SharePointSQL Server 會要求您提供其他資訊,才允許您使用。For example, SharePoint and SQL Server require additional information before you can use them.

檢視或變更資料來源View or change a data source

如果您正在更新應用程式,可能需要找出或變更資源庫、表單或另一個控制項中出現且具有 Item 屬性的資料來源。If you're updating an app, you might need to identify or change the source of data that appears in a gallery, a form, or another control that has an Item property. 例如,您可能會使用他人所建立的應用程式,或可能需要提醒自己不久前設定的資料來源。For example, you might be working on an app that someone else created, or you might want to remind yourself of a data source that you configured a while ago.

  1. 選取您要識別資料來源的控制項。Select the control for which you want to identify the data source.

    例如,選取資源庫 (不是資源庫內的控制項),方法是在階層式清單和左邊緣附近的控制項中按一下或點選資源庫。For example, select a gallery (not a control within the gallery) by clicking or tapping it in the hierarchical list of screens and controls near the left edge.

    資料來源的名稱會出現在右側窗格的 [屬性] 的索引標籤上。The name of the data source appears on the Properties tab of the right-hand pane.

    [屬性] 索引標籤上的資料來源

  2. 若要顯示有關資料來源的詳細資訊或將它變更,請在右側窗格中按一下或點選 [資料]。To show more information about the data source or change it, click or tap Data in the right-hand pane.

    [資料] 窗格

  3. 若要變更資料來源,請按一下或點選資料來源旁的向下箭頭,然後選擇或建立另一個來源。To change the data source, click or tap the down arrow next to the data source, and then choose or create another source.

後續步驟Next steps