使用报表 Web 部件在 SharePoint Online 中嵌入报表Embed with report web part in SharePoint Online

借助 Power BI 新推出的适用于 SharePoint Online 的报表 Web 部件,可以在 SharePoint Online 页面中轻松嵌入交互式 Power BI 报表。With Power BI's new report web part for SharePoint Online, you can easily embed interactive Power BI reports in SharePoint Online pages.

使用新的“在 SharePoint Online 中嵌入”选项时,嵌入的报表绝对安全,因此你可以轻松创建安全的内部门户。When using the new Embed in SharePoint Online option, the embedded reports are fully secure so you can easily create secure internal portals.

要求Requirements

若要让“在 SharePoint Online 中嵌入”报表正常呈现,需要满足一些要求。There are a few requirements in order for Embed in SharePoint Online reports to work.

  • 适用于 SharePoint Online 的 Power BI Web 部件要求使用新式页面The Power BI web part for SharePoint Online requires Modern Pages.

嵌入报表Embed your report

若要将报表嵌入 SharePoint Online,必须先获取报表 URL,然后才能在 SharePoint Online 中将此 URL 用于新 Power BI Web 部件。In order to embed your report into SharePoint Online, you will first need to get the URL for the report and then use that URL with the new Power BI web part within SharePoint Online.

获取报表的 URLGet a URL to your report

  1. 在 Power BI 服务中查看报表。View the report within the Power BI service.

  2. 选择“文件”菜单项。Select the File menu item.

  3. 选择“在 SharePoint Online 中嵌入”。Select Embed in SharePoint Online.

  4. 复制对话框中的 URL。Copy URL from dialog.

    备注

    还可以使用在查看报表时 Web 浏览器地址栏中显示的 URL。You can also use the URL that is displayed in your web browser's address bar when viewing a report. 此 URL 包含当前查看的报表页名称。That URL will contain the report page you are currently viewing. 若要嵌入不同的页,需要从 URL 中删除报表部分。You will need to remove the report section, from the URL, if you want to use a different page.

将 Power BI 报表复制到 SharePoint Online 页面Add the Power BI report to a SharePoint Online page

  1. 打开相应的 SharePoint Online 页面,然后选择“编辑”。Open the desired page in SharePoint Online and select Edit.

    或者,在 SharePoint Online 中选择“+ 新建”,新建新式网站页面。Or, create a new modern site page by selecting + New within SharePoint Online.

  2. 依次选择“+”和“Power BI”Web 部件。Select + and select the Power BI web part.

  3. 选择“添加报表”。Select Add report.

  4. 将报表 URL 粘贴到属性窗格中。Past the report URL into the property pane. 这就是从上述步骤中复制的 URL。This is the URL you copied from the steps above. 此时,报表会自动加载。The report will load automatically.

  5. 选择“发布”,让 SharePoint Online 用户可以看到此更改。Select Publish to make the change visible to your SharePoint Online users.

授予报表访问权限Granting access to reports

在 SharePoint Online 中嵌入报表不会自动授予用户报表查看权限。Embedding a report in SharePoint Online does not automatically give users permission to view the report. 需要在 Power BI 服务中设置报表查看权限。The permissions to view the report are set within the Power BI service.

重要

请务必在 Power BI 中检查哪些人员可以查看报表,然后向未列出的人员授予访问权限。Make sure to review who can see the report within the Power BI service and grant access to those not listed.

在 Power BI 服务中授予报表访问权限的方法有两种。There are two ways to provide access to the report within the Power BI service. 若要使用 Office 365 组生成 SharePoint Online 团队网站,请在 Power BI 服务中将用户列为应用工作区的成员。If you are using an Office 365 Group to build your SharePoint Online team site, you list the user as a member of the app workspace within the Power BI service. 这样就能确保用户可以查看相应组的内容。This will make sure that users can view the contents of that group. 有关详细信息,请参阅在 Power BI 中创建和分发应用For more information, see Create and distribute an app in Power BI.

或者,可以按下列步骤来授予用户报表访问权限。Alternatively, you can grant users access to your report by doing the following.

  1. 将一个磁贴从报表添加到仪表板。Add a tile from the report to a dashboard.

  2. 与需要报表访问权限的用户共享此仪表板。Share the dashboard with the users that need access to the report. 有关详细信息,请参阅与同事和其他人共享仪表板For more information, see Share a dashboard with colleagues and others.

Web 部件设置Web part settings

下面介绍了可以为适用于 SharePoint Online 的 Power BI Web 部件调整的设置。Below is a description of the settings that can be adjusted for the Power BI web part for SharePoint Online.

属性Property 说明Description
页名称Page name 设置 Web 部件显示的默认页。Sets the default page that is shown by the web part. 从下拉列表中选择一个值。Select a value from the drop down. 如果下拉列表中未显示任何页,要么是因为报表只有一页,要么是因为粘贴的 URL 包含页名称。If no pages are displayed, either your report has one page, or the URL you pasted contains a page name. 从 URL 中删除报表部分即可选择特定页。Remove the report section from the URL to select a specific page.
显示Display 用于调整报表如何能与 SharePoint Online 页面浑然一体的选项。Option to adjust how the report is fit within the SharePoint Online page.
显示导航窗格Show Navigation Pane 显示或隐藏报表页导航窗格。Shows or hides the page navigation pane.
显示筛选窗格Show Filter Pane 显示或隐藏筛选窗格。Shows or hides the filter pane.

多重身份验证Multi-factor authentication

如果 Power BI 环境要求使用多重身份验证进行登录,系统可能会提示你使用安全设备登录,从而验证你的身份。If your Power BI environment requires you to sign-in using multi-factor authentication, you may be asked to sign-in with a security device to verify your identity. 如果未使用多重身份验证登录 SharePoint Online,而 Power BI 环境又要求使用经过安全设备验证的帐户,就会发生这种情况。This will occur if you did not sign-in to SharePoint Online using multi-factor authentication but your Power BI environment requires an account validated by a security device.

备注

Azure Active Directory 2.0 尚不支持多重身份验证。Multi-factor authentication is not yet supported with Azure Active Directory 2.0. 用户会看到“错误”消息。Users will receive a message saying error. 如果用户使用安全设备重新登录 SharePoint Online,则可以查看报表。If the user signs-in again to SharePoint Online using their security device, they may be able to view the report.

报表没有加载Reports that do not load

Power BI Web 部件中可能无法加载报表,并显示以下消息。Your report may not load within the Power BI web part and may show the following message.

无法加载此内容。This content isn't available.

看见此消息的常见原因有两个。There are two common reasons for this message.

  1. 无权访问报表。You do not have access to the report.
  2. 报表已遭删除。The report was deleted.

应与 SharePoint Online 页面的所有者联系,让其帮助你解决此问题。You should contact the owner of the SharePoint Online page to help you resolve the issue.

已知问题和限制Known issues and limitations

  • 错误:“出错,请尝试注销并重新登录,然后重新访问此页。相关 ID:未定义; http 响应状态: 400;服务器错误代码: 10001;消息:缺少刷新令牌”Error: "An error occurred, please try logging out and back in and then revisiting this page. Correlation id: undefined, http response status: 400, server error code 10001, message: Missing refresh token"

    如果看到此错误,请尝试执行下列一项操作。If you receive this error, please try one of the following.

    1. 注销并重新登录 SharePoint。Sign-out of SharePoint and sign back in. 请务必在重新登录前关闭所有浏览器窗口。Be sure to close all browser windows before signing back in.

    2. 如果用户帐户要求进行多重身份验证 (MFA),请务必使用多重身份验证设备(如手机应用、智能卡等)登录 SharePointIf your user account requires multi-factor authentication (MFA), ensure you sign-in to SharePoint using your multi-factor authentication device (phone app, smart card, etc.)

  • Power BI 不支持 SharePoint Online 支持的本地化语言。Power BI does not support the same localized languages that SharePoint Online does. 因此,可能无法在嵌入的报表中看到正确的本地化内容。As a result, you may not see proper localization within the embedded report.

  • 如果使用的是 Internet Explorer 10,可能会遇到问题。You may encounter issues if using Internet Explorer 10. 可以查看 Power BI 支持的浏览器Office 365 支持的浏览器You can look at the browsers support for Power BI and for Office 365.

后续步骤Next steps

允许或禁止最终用户创建新式网站页面Allow or prevent creation of modern site pages by end users
在 Power BI 中构建和分发应用Create and distribute an app in Power BI
与同事和其他人共享仪表板Share a dashboard with colleagues and others
Power BI Premium 有哪些特权?Power BI Premium - what is it?

更多问题?More questions? 尝试咨询 Power BI 社区Try asking the Power BI Community