画布概述-适用于电源应用的应用连接器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.


如果你的连接器提供表,则添加数据源,然后选择要管理的数据源中的表。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. 继续前面的示例,通过将该名称用作 Search 和 SortByColumn 函数的参数,你可以对 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.


如果你的连接器提供操作,则必须与前面一样仍选择数据源。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:



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. 与此相反,Power 自动功能适用于动态架构,并可能为你的方案提供了解决方法。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 用户 Office 365 用户Office 365 Users
Oracle 联手Oracle   Power BI Power BIPower BI
SharePoint SharePointSharePoint   SQL Server SQL ServerSQL Server
Twitter TwitterTwitter

* * 适用于 Azure Blob、Box、Dropbox、Google Drive、OneDrive 和 OneDrive for business** 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. 有关详细信息,请参阅电源应用计划For more information, see Power Apps Plans.

可以在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 身份验证的任何连接来创建应用程序。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.