適用于 Power Apps 的畫布應用程式連接器總覽Overview of canvas-app connectors for Power Apps

資料是大部分應用程式的核心,包括您在 Power Apps 中建立的。Data is at the core of most apps, including those you build in Power Apps. 資料會儲存在「資料來源」中,藉由建立「連線」即可將該資料帶入應用程式。Data is stored in a data source, and you bring that data into your app by creating a connection. 連線會使用特定的「連接器」與資料來源通訊。The connection uses a specific connector to talk to the data source. Power Apps 的連接器適用于許多熱門服務和內部部署資料來源,包括 SharePoint、SQL Server、Office 365、Salesforce 和 Twitter。Power Apps has connectors for many popular services and on-premises data sources, including SharePoint, SQL Server, Office 365, Salesforce, and Twitter. 若要開始將資料新增至畫布應用程式,請參閱在 Power Apps 中新增資料連線To get started adding data to a canvas app, see Add a data connection in Power Apps.

連接器可能會提供資料或動作資料表A connector may provide tables of data or actions. 有些連接器只提供資料表、有些只提供動作,有些則提供兩者。Some connectors provide only tables, some provide only actions, and some provide both. 此外,您的連接器可能是標準或自訂連接器。Also your connector may be either a standard or custom connector.

資料表Tables

如果您的連接器提供資料表,請新增資料來源,然後選取您想要管理的資料來源中資料表。If your connector provides tables, you add your data source and then select the table in the data source that you want to manage. Power Apps 會將資料表資料捕獲到您的應用程式,並為您更新資料來源中的資料。Power Apps both retrieves table data into your app and updates data in your data source for you. 例如,您可以新增包含名為 Lessons 資料表的資料來源,然後在公式列中將控制項 (例如資源庫或表單) 的 Items 屬性設定為此值:For example, you can add a data source that contains a table named Lessons and then set the Items property of a control, such as a gallery or a form, to this value in the formula bar:

純資料來源 Items 屬性

您可以藉由自訂顯示資料之控制項的Items屬性,來指定您的應用程式所抓取的資料。You can specify the data that your app retrieves by customizing the Items property of the control that shows your data. 繼續上述範例,您可以使用該名稱作為 SearchSortByColumn 函式的引數,來排序或篩選 Lessons 資料表中的資料。Continuing the previous example, you can sort or filter the data in the Lessons table by using that name as an argument for the Search and SortByColumn functions. 在本圖中,設定 Items 屬性的公式指定根據 TextSearchBox1 中的文字來排序和篩選資料。In this graphic, the formula to which the Items property is set specifies that the data is sorted and filtered based on the text in TextSearchBox1.

展開的資料來源 Items 屬性

如需如何使用資料表自訂公式的詳細資訊,請參閱下列主題:For more information about how to customize your formula with tables, see these topics:

瞭解 Power Apps 中的資料來源Understand data sources in Power Apps
從 Excel 資料產生應用程式Generate an app from Excel data
從頭建立應用程式Create an app from scratch
瞭解 Power Apps 中的資料表和記錄Understand tables and records in Power Apps

注意

若要連線至 Excel 活頁簿中的資料,它必須裝載至雲端儲存體服務 (例如 OneDrive)。To connect to data in an Excel workbook, it must be hosted in a cloud-storage service such as OneDrive. 如需詳細資訊,請參閱從 Power Apps 連接到雲端儲存體For more information, see Connect to cloud-storage from Power Apps.

動作Actions

如果您的連接器提供動作,您還是必須如前選取資料來源。If your connector provides actions, you must still select your data source as you did before. 不過,您可以編輯將顯示您資料之控制項的 Items 屬性,手動將控制項連線至動作,而不是選取資料表作為下個步驟。Instead of selecting a table as the next step, however, you manually connect a control to an action by editing the Items property of the control that will show your data. 您用於設定 Items 屬性之公式可指定擷取資料的動作。The formula to which you set the Items property specifies the action that retrieves data. 例如,如果您連線至 Yammer,然後將 Items 屬性設定為資料來源名稱,則應用程式不會擷取任何資料。For example, the app won't retrieve any data if you connect to Yammer and then set the Items property to the name of the data source. 若要將資料填入控制項,請指定 GetMessagesInGroup(5033622).messages 這類動作。To populate a control with data, specify an action such as GetMessagesInGroup(5033622).messages.

動作資料來源 Items 屬性

如果您需要處理動作連接器的自訂資料更新,則請建置包含 Patch 函式的公式。If you need to handle custom data updates for action connectors, build a formula that includes the Patch function. 在公式中,識別動作以及您將繫結至動作的欄位。In the formula, identify the action and the fields that you'll bind to the action.

如需如何自訂自訂更新之公式的詳細資訊,請參閱下列主題:For more information about how to customize your formula for custom updates, see these topics:

PatchPatch
CollectCollect
UpdateUpdate

注意

Power Apps 無法與動態架構搭配使用。Power Apps doesn't work with dynamic schema. 「動態架構」一詞指的是,相同動作可能會傳回具有不同資料行的不同資料表的可能性。The phrase dynamic schema refers to the possibility that the same action may return a different table with different columns. 可能導致資料表中的資料行不同的條件包括動作輸入參數、執行動作的使用者或角色,以及使用者在其中工作的群組,還有其他專案。Conditions that may cause the columns in the tables to differ include the action input parameters, the user or role that's executing the action, and the group in which the user is working, among others. 例如,如果以不同的輸入執行,SQL Server 預存程式可能會傳回不同的資料行。For example, SQL Server stored procedures may return different columns if run with different inputs. 針對具有動態架構的動作,連接器檔會顯示這項作業的輸出是動態的。For actions with dynamic schema, the connector documentation shows The outputs of this operation are dynamic. 做為傳回值。as the return value. 相反地,電源自動化適用于動態架構,而且可能會為您的案例提供因應工作。In contrast, Power Automate works with dynamic schema and might provide a work-around for your scenario.

此資料表的連結可提供最熱門連接器的詳細資訊。This table has links to more information about our most popular connectors. 如需連接器的完整清單,請參閱所有連接器For a complete list of connectors, see All connectors.

         
Common Data Service Common Data ServiceCommon Data Service   雲端儲存空間 雲端儲存體 **Cloud storage **
Dynamics 365 Dynamics 365Dynamics 365   Dynamics AX Dynamics AXDynamics AX
Excel ExcelExcel   Microsoft Translator Microsoft TranslatorMicrosoft Translator
Office 365 Outlook Office 365 OutlookOffice 365 Outlook   Office 365 Users Office 365 UsersOffice 365 Users
Oracle OracleOracle   Azure 使用狀況 Power BIPower BI
SharePoint SharePointSharePoint   SQL Server SQL ServerSQL Server
Twitter TwitterTwitter

* * 適用于 Azure Blob、Box、Dropbox、Google 雲端硬碟、OneDrive 和商務用 OneDrive** Applies to Azure Blob, Box, Dropbox, Google Drive, OneDrive and OneDrive for Business

標準和自訂連接器Standard and custom connectors

Power Apps 為許多常用的資料來源提供標準連接器。Power Apps provides standard connectors for many commonly used data sources. 如果 Power Apps 的標準連接器適用于您想要使用的資料來源類型,您應該使用該連接器。If Power Apps has a standard connector for the type of data source that you want to use, you should use that connector. 如果您想要連線至其他資料來源類型 (例如您所建置的服務),請參閱註冊及使用自訂連接器If you want to connect to other types of data sources, such as a service that you've built, see Register and use custom connectors.

所有標準連接器All standard connectors

標準連接器不需要特殊授權。Standard connectors do not require special licensing. 如需詳細資訊,請參閱Power Apps 方案For more information, see Power Apps Plans.

您可以在Power apps 論壇中詢問有關特定連接器的問題,也可以建議連接器新增或其他改進功能,以在Power apps 的想法中進行。You can ask questions about a specific connector in the Power Apps forums, and you can suggest connectors to add or other improvements to make in Power Apps Ideas.

驗證的安全性和類型Security and types of authentication

當您撰寫應用程式並建立資料來源的連接時,您可能會看到您選擇的連接器可讓您使用不同的驗證方式。As you author your app and create a connection to a data source, you may see that your choice of connector allows you to use different ways to authenticate. 例如,SQL Server 連接器可讓您使用 Azure AD 整合式、SQL Server 驗證和 Windows 驗證。For instance, the SQL Server connector allows you to use Azure AD Integrated, SQL Server Authentication, and Windows Authentication. 每種驗證類型都有與其相關聯的不同安全性層級。Each type of authentication has different levels of security associated with it. 請務必瞭解您與使用應用程式的使用者共用哪些資訊和許可權。It's important to understand what information and rights you share with users who use your application. 本文中的主要範例是 SQL Server 的,不過,這些原則適用于所有類型的連接。The primary example in this article is SQL Server, however the principles apply to all types of connections.

Azure AD 整合Azure AD Integrated

這是安全的連線類型。This is a secure type of connection. 例如,SharePoint 會使用這種類型的驗證。For example, SharePoint uses this type of authentication. SQL Server 也允許這種類型的驗證。SQL Server also allows for this type of authentication. 當您連接時,Azure AD 服務會代表您分別識別您的 SharePoint。When you connect, the Azure AD service identifies you separately to SharePoint on your behalf. 您不需要提供使用者名稱或密碼。You do not have to supply a username or password. 身為作者,您可以使用您的認證來建立及使用資料來源。As an author you can create and work with the data source with your credentials. 當您發佈應用程式,且應用程式使用者登入時,他們會使用其認證來執行此動作。When you publish your application and your application user logs in, they do so with their credentials. 如果資料在後端受到適當的保護,則使用者只能看到他們根據其認證來查看的授權內容。If the data is appropriately secured on a back-end your users can only see what they are authorized to see based on their credentials. 這種類型的安全性可讓您在發行應用程式之後,變更後端資料來源上特定應用程式使用者的許可權。This type of security allows you to change rights for specific application users on the back-end data source after the application has been published. 例如,您可以授與存取權、拒絕存取權,或精簡使用者或集合可以在後端資料來源上看到的所有內容。For instance you can grant access, deny access, or refine what a user or set of users can see all on the back-end data source.

開放式標準授權(OAuth)Open-standard authorization (OAuth)

這種類型的連接也是安全的。This type of connection is also secure. 例如,Twitter 會使用這種類型的驗證。For example Twitter uses this type of authentication. 當您連接時,必須提供您的使用者名稱和密碼。When you connect you must supply your user name and password. 身為作者,您可以使用您的認證來建立及使用資料來源。As an author you can create and work with the data source with your credentials. 當您發行應用程式,而且應用程式使用者登入時,他們也必須提供其認證。When you publish your application and your application user logs in, they must also supply their credentials. 因此,這種類型的連線是安全的,因為您的使用者必須使用自己的認證來存取資料來源服務。Therefore this type of connection is secure as your users must use their own credentials to access the data source service.

SQL 使用者名稱和密碼驗證SQL User name and password authentication

這是連線的類型並不安全,因為它不會依賴使用者驗證。This is type of connection is not very secure because it does not rely on end-user authentication. SQL Server 也允許這種類型的驗證。SQL Server also allows for this type of authentication. 在 SQL Server 這種類型的驗證會SQL Server 驗證中呼叫。In SQL Server this type of authentication is called SQL Server Authentication. 許多其他資料庫資料來源都會提供類似的功能。Many other database data sources provide a similar capability. 當您發行應用程式時,您的使用者不需要提供唯一的使用者名稱和密碼。When you publish your application, your users do not need to supply a unique user name and password. 他們會使用您在撰寫應用程式時所提供的使用者名稱和密碼。They are using the user name and password you supply when you author the application. 對資料來源的連接驗證會與您的使用者隱含地共用The connection authentication to the data source is Implicitly Shared with your users. 一旦應用程式發佈之後,連線也會發佈,並可供您的使用者使用。Once the application is published, the connection is also published and available to your users. 您的終端使用者也可以使用與他們共用 SQL Server authentication 的任何連線來建立應用程式。Your end users can also create applications using any connection using SQL Server authentication that is shared with them. 您的使用者看不到密碼的使用者名稱,但是連接將可供使用。Your users cannot see the user name of password, but the connection will be available to them. 此類型的連線有一定的有效案例。There are certainly valid scenarios for this type of connection. 例如,如果您有一個唯讀資料庫可供公司中的所有人使用,這種類型的連線可能會是有效的。For instance if you have a read-only database that is available to everyone in the company, this type of connection may be valid.

Windows 驗證Windows Authentication

這種類型的連接並不安全,因為它不會依賴使用者驗證。This type of connection is not very secure because it doesn't rely on end-user authentication. 當您需要連接到內部部署的資料來源時,請使用 Windows 驗證。Use Windows authentication when you need to connect to a data source that is on-premises. 這種連線類型的範例是指具有 SQL Server 的內部部署伺服器。An example of this type of connection is to an on-premises server that has a SQL Server. 連接必須經過閘道。The connection must go through a gateway. 由於它會通過閘道,因此連接器可以存取該資料來源上的所有資料。Since it goes through a gateway, the connector has access to all of the data on that data source. 因此,您可以使用您所提供的 Windows 認證存取的任何資訊,都可用於連接器。As a result, any information that you can access with the Windows credentials you supply are available to the connector. 一旦應用程式發佈之後,連接也會發佈,並可供您的使用者使用。And once the application is published, the connection is also published and available to your users. 這表示您的終端使用者也可以使用這個相同的連線來建立應用程式,並存取該電腦上的資料。This means that your end users can also create applications using this same connection and access the data on that machine. 與資料來源的連接也會與應用程式共用的使用者隱含地共用Connections to the data source are also Implicitly Shared with users that the app is shared with. 當您的資料來源只存在於內部部署伺服器,而且該來源上的資料可自由共用時,這種類型的連接可能會是有效的。This type of connection may be valid when your data source only lives on an on-premises server and the data on that source is freely shareable.