从 PowerApps 连接到 SharePointConnect to SharePoint from PowerApps

SharePoint

连接 SharePoint 站点,从列表自动生成应用、从头开始构建应用或更新现有应用。Connect to a SharePoint site to generate an app automatically from a list, build an app from scratch, or update an existing app.

已知问题Known issues

可从自定义列表而不是库中添加数据。You can add data from a custom list but not a library. 此外,并非所有列类型均受支持,且并非所有类型的列都支持所有类型的卡。In addition, not all types of columns are supported, and not all types of columns support all types of cards.

列类型Column type 支持Support 默认卡Default cards
单行文本Single line of text Yes 视图文本View text
多行文本Multiple lines of text Yes 视图文本View text
选择Choice 是(只允许单个值)Yes (single values only) 视图查找View lookup
NumberNumber Yes 视图百分比View percentage
视图分级View rating
视图文本View text
货币Currency Yes 视图百分比View percentage
视图分级View rating
视图文本View text
日期和时间Date and Time Yes 视图文本View text
查找Lookup 是(只允许单个值)Yes (single values only) 视图查找View lookup
编辑查找Edit lookup
布尔值(是/否)Boolean (Yes/No) Yes 视图文本View text
视图切换View toggle
用户或用户组Person or Group 是(只允许单个值)Yes (single values only) 视图查找View lookup
编辑查找Edit lookup
超链接Hyperlink Yes 视图 URLView URL
视图文本View text
图片Picture 是(只读)Yes (read-only) 视图图像View image
视图文本View text
已计算Calculated 是(只读)Yes (read-only)
任务结果Task Outcome No
外部数据External data No
托管元数据Managed Metadata 是(只读)Yes (read-only)
评分Rating No

此外,PowerApps 不支持支持多个值或选择内容的列。Moreover, PowerApps doesn't support columns that support multiple values or selections.

  • 对于查找列,必须清除“允许多个值”复选框。For Lookup columns, the Allow multiple values checkbox must be cleared.

    用于允许在查找列中使用多个值的复选框

  • 对于“托管元数据”列,必须清除“允许多个值”复选框。For Managed Metadata columns, the Allow multiple values checkbox must be cleared.

    用于允许在托管元数据列中使用多个值的复选框

  • 对于用户或用户组列,必须选择“允许多个选择”下的“否”选项。For Person or Group columns, the No option under Allow multiple selections must be selected.

    用于允许对用户或用户组列使用多个选择的选项

  • 对于“选择”列,必须选择“选择显示方式”下的“下拉菜单”或“单选按钮”选项。For Choice columns, the Drop-Down Menu or Radio Buttons option under Display choices using must be selected.

    用于显示“选择”列的选择的选项

包含可被 PowerApps 读取的空格,但空格被替换为十六进制转义代码“_x0020_”的列。Columns that contain spaces can by read by PowerApps, but the spaces are replaced with the hexadecimal escape code "_x0020_". 例如,如果 SharePoint 中的“Column Name”在数据布局中显示或用于公式,它将在 PowerApps 中显示为“Column_x0020_Name”。For example, "Column Name" in SharePoint will appear as "Column_x0020_Name" in PowerApps when displayed in the data layout or used in a formula.

必备组件Prerequisites

可使用以下任一步骤打开 PowerApps:Open PowerApps by taking either of these steps:

创建应用Create an app

将 SharePoint 列表添加到现有应用Add a SharePoint list to an existing app

  1. 在 PowerApps Studio 中,打开想要更新的应用。In PowerApps Studio, open the app that you want to update.
  2. 在功能区的“视图”选项卡上,单击或点击“数据源”。On the View tab of the ribbon, click or tap Data sources
  3. 单击或点击右侧窗格中的“添加数据源”。In the right-hand pane, click or tap Add data source.

    添加数据源

  4. 单击或点击“新连接”,单击或点击“SharePoint”,然后单击或点击“连接”。Click or tap New connection, click or tap SharePoint, and then click or tap Connect.

    添加 SharePoint 连接

  5. 指定想要连接的 SharePoint 站点类型:Specify the type of SharePoint site to which you want to connect:

    指定连接类型

    • 单击或点击“直接连接(云服务)”以连接到 SharePoint Online。Click or tap Connect directly (cloud services) to connect to SharePoint Online.
    • 单击或点击“使用本地数据网关连接”以连接到本地 SharePoint 站点。Click or tap Connect using on-premises data gateway to connect to an on-premises SharePoint site.

      指定 Windows 作为身份验证类型,然后指定凭据。Specify Windows as the authentication type, and then specify your credentials. (如果凭据包括域名,则将其指定为 域\别名。)(If your credentials include a domain name, specify it as domain\alias.)

      指定凭据

      注意:如果未安装本地数据网关,则请安装,然后单击或点击图标来刷新网关列表。Note: If you don't have an on-premises data gateway installed, install one, and then click or tap the icon to refresh the list of gateways.

      在“选择网关”下,单击或点击要使用的网关。Under Choose a gateway, click or tap the gateway that you want to use.

      选择网关

  6. 单击或点击“连接”。Click or tap Connect.
  7. 在“连接到 SharePiont 站点”下,单击或点击“最近使用的站点”列表中的记录(或者键入或粘贴要使用的站点的 URL),然后单击或点击“转到”。Under Connect to a SharePoint site, click or tap an entry in the Recent sites list (or type or paste the URL for the site that you want to use), and then click or tap Go.

    选择 SharePoint 站点

  8. 在“选择列表”下,选中要使用的一个或多个列表的复选框,再单击或点击“连接”:Under Choose a list, select the check box for one or more lists that you want to use, and then click or tap Connect:

    选择 SharePoint 中的表格

    默认情况下,并非所有类型的列表都会显示。Not all types of lists appear by default. 如果要使用的列表名称未显示,请滚动到底部,再在“输入自定义列表名称”框中键入列表名称。If the name of the list that you want to use doesn't appear, scroll to the bottom, and then type the name of the list in the box that contains Enter a custom list name.

    SharePoint 中的自定义列表

    数据源已添加到应用。The data sources are added to your app.

    添加到应用的数据源的列表

若要在库中显示这些列类型中任一类型列中的数据,请使用编辑栏设置库中一个或多个“标签”控件的“Text”属性:To show data from any of these types of columns in a gallery, use the formula bar to set the Text property of one or more Label controls in that gallery:

  • 对于“选择”或“查找”列,请指定 ThisItem.[ColumnName].Value 以显示该列中的数据。For a Choice or Lookup column, specify ThisItem.[ColumnName].Value to show data in that column.

    例如,如果具有名为 Location 的“选择”列,请指定 ThisItem.Location.Value,如果有名为 PostalCode 的“查找”列,请指定 ThisItem.PostalCode.ValueFor example, specify ThisItem.Location.Value if you have a Choice column named Location, and specify ThisItem.PostalCode.Value if you have a Lookup column named PostalCode.

  • 对于“用户或用户组”列,请指定 ThisItem.[ColumnName].DisplayName 以显示该用户或用户组的显示名称。For a Person or Group column, specify ThisItem.[ColumnName].DisplayName to show the display name of the user or the group.

    例如,指定 ThisItem.Manager.DisplayName 以显示名为 Manager 的“用户或用户组”列中的显示名称。For example, specify ThisItem.Manager.DisplayName to show display names from a Person or Group column named Manager.

    还可以显示关于用户的其他信息,如电子邮件地址或职务等。You can also show different information about users, such as email addresses or job titles. 若要显示完整的选项列表,请指定 ThisItem.[ColumnName].To display a complete list of options, specify ThisItem.[ColumnName]. (含结尾句点)。(with the trailing period).

    注意:对于“创建者”列,请指定 ThisItem.Author.DisplayName 以显示创建列表中的项的用户的显示名称。Note: For a CreatedBy column, specify ThisItem.Author.DisplayName to show the display names of users who created items in the list. 对于“修改者”列,请指定 ThisItem.Editor.DisplayName 以显示更改列表中的项的用户的显示名称。For a ModifiedBy column, specify ThisItem.Editor.DisplayName to show the display names of users who changed items in the list.

  • 对于“托管元数据”列,请指定 ThisItem.[ColumnName].Label 以显示该列中的数据。For a Managed Metadata column, specify ThisItem.[ColumnName].Label to show data in that column.

    例如,如果具有名为 Languages 的“托管元数据”列,请指定 ThisItem.Languages.LabelFor example, specify ThisItem.Languages.Label if you have a Managed Metadata column named Languages.

后续步骤Next steps