Part 1: 如何把Power BI 嵌入到sharepoint 网站

本文是转载,转自:http://rolandoldengarm.com/index.php/2016/04/27/part-1-how-to-embed-powerbi-in-a-sharepoint-site/

One of the most requested features for PowerBI was to be able to embed it in any web application. This has now been implemented with Power BI Embedded. An excellent demo created by Microsoft can be found here. While this is a very cool feature, it is aiming at developers. Another feature request that many of our customers have is to embed reports in a SharePoint site, e.g. to display it on an intranet.

Currently there is no out-of-the-box web part to display a PowerBI report in a SharePoint site. What I am going to show you, is how to do this with a provider hosted add-in!

Update September 2016: Part 3 is available.

name="aswift_3" width="676" height="60" id="aswift_3" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" vspace="0" hspace="0" allowfullscreen="true" style="left: 0px; top: 0px; width: 676px; height: 60px; position: absolute;" allowtransparency="true" data-origwidth="676" data-origheight="60">

While below instructions are working on my environments, some people have found some issues with this approach. In Part 3 I am using the Power BI Embedded service in the SharePoint Framework which solves those issues.


Essentially the app will work as follows:

  1. The App allows the user to sign in.
  2. After signing in, a list of Dashboards is shown.
  3. After selecting a Dashboard, a list of Tiles on that dashboard is shown.
  4. When selecting a Tile an pressing confirm, that particular tile will be displayed on the SharePoint site.

As a lot of steps are involved, I will focus on steps 1 – 3 in this part of the blog post series, and in part 2 I will show how to embed it into a SharePoint site. The source code can be found on GitHub

Register a Power BI App

The first step is to register a Power BI App. This works similar to registering an app for Azure AD. Under water it is the same, when you create a Power BI App, an Azure AD App is created for you.

Go to https://dev.powerbi.com/apps and fill out the form. I have done it as follows:

Regarding permissions, I’ve chosen to enable all permissions, just as I don’t want to waste time on 401 errors. In a production scenario, you should only pick what you need.

The last step is click Register App. Please keep in mind there is no Edit function. Every time you click Register App, a new app is created in Azure.

Create a Provider Hosted Add-in

Open Visual Studio (preferably 2015), and click File > New Project.  Select Office/SharePoint > App for SharePoint

Click OK and specify the following settings:

The URL must be a developer site on Office 365.  Click Next and log in. In the next screen, select “SharePoint Online”. In the final screen I’ve selected Web Forms. For Production purposes I would recommend to use MVC, but with Web Forms it is quicker to develop a basic app.

I prefer to use IIS (instead of IIS Express). Go to the project settings of the Web Project, go to Web, and change IIS Express to Local IIS. Also change Project URL to https instead of http. Finally, click on Create Virtual Directory.

Please note that this requires Visual Studio to be run as Administrator, and that IIS is configured on your machine.

The application

Please have a look at the source code on GitHub. It will take forever to explain every line of source code, so I will take you through the important bits:

  • NuGet Packages: Add the following NuGet Packages:

    • Newtonsoft.JSON
    • Microsoft.IdentityModel.Clients.ActiveDirectory
  • Settings: Double click Properties, go to Settings and create a default settings file. Add two settings: ClientId and ClientSecret, and copy the values from the PowerBI App.
  • Redirect.aspx: When the OAuth flow complete,
  • Default.aspx: This page is the main entry point of the application. It contains a Login button, which handles the authentication flow with Azure AD. After logging in, it will display the Dashboards in a drop down. When selecting an item, it will display all Tiles in that dashboard in another drop down. And finally, when a tile is selected, this report will be displayed.
    Some client-side JavaScript is required to handle the authentication for the iframe. All other authentication happens server-side.
    In Part 2 of this blog post series I will show how to inject scripts into the host web, to show the report in the SharePoint site.

The result!

I have added the sample “Sales and Marketing” dashboard to my PowerBI instance:

Then, after

  • I deploy the app from Visual Studio via F5.
  • Trust the App
  • Click “Sign In”
  • Log into Power BI
  • Accept the permissions requested:

… the sign in button disappears and I see the dashboards. I select the only dashboard in my account:

… and the first Tile in the Dashboard:

After waiting a bit, the dashboard should show up like this:

We have embedded PowerBI in a SharePoint Add-in

Goal 1 is achieved: Embed a PowerBI report in a SharePoint Provider Hosted Add-In. The next step is to inject this into the host SharePoint web. I will follow the approach the PnP team is using in their AppScriptPart sample. I will show this in Part 2 of this series! Follow me on Twitter to be the first to know.

Part 1: 如何把Power BI 嵌入到sharepoint 网站相关推荐

  1. sharepoint页面嵌入_Part 1: 如何把Power BI 嵌入到sharepoint 网站

    Part 1: 如何把Power BI 嵌入到sharepoint 网站 本文是转载,转自:http://rolandoldengarm.com/index.php/2016/04/27/part-1 ...

  2. 微软Power BI技术文章与资源目录

    下面是本博客原创的微软Power BI技术相关文章,对于部分转载文章和资源,会注明出处. 本博客将发布基于微软Power BI相关的基础入门文章,视频教程等资源,敬请关注. 个人建立的Power BI ...

  3. power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序

    power bi报表服务器 Every once in a while, teams from different functional areas of the business (i.e. bus ...

  4. 在 SharePoint Server 中使用 iFrame 嵌入“Power BI 报表服务器”报表

    在本快速入门中,你将了解如何通过在 SharePoint 页面中使用 iFrame 嵌入 Power BI 报表服务器报表. 如果正在使用 SharePoint Online,则必须可以公开访问 Po ...

  5. 如何选择数据分析可视化工具?Excel, Tableau还是Power BI?

    来源:大数据文摘 本文约3500字,建议阅读5分钟 作为个人或公司,如何选择分析和可视化数据的工具? 正确分析使用数据可能会挖到宝藏.那么,作为个人或公司,如何选择分析和可视化数据的工具? 在本文中, ...

  6. power python_在 Power BI Desktop 中运行 Python 脚本

    在 Power BI Desktop 中运行 Python 脚本Run Python scripts in Power BI Desktop 06/02/2020 本文内容 你可以直接在 Power ...

  7. html 接收 图片流_Microsoft Flow 利用自动化工作流增强Power BI使用效率

    [前述:Microsoft Flow和Power BI都属于微软Power平台的一部分.在微软Power平台的官网,你可以看到关于该平台的以下介绍: "Power BI.PowerApps和 ...

  8. power bi可视化表_如何使用Power BI可视化数据?

    power bi可视化表 什么是数据可视化? (What is Data Visualization?) With the technological revolution, data went fr ...

  9. power-bi_在Power BI中的VertiPaq内-压缩成功!

    power-bi Have you ever wondered what makes Power BI so fast and powerful when it comes to performanc ...

  10. power bi_如何将Power BI模型的尺寸减少90%!

    power bi Have you ever wondered what makes Power BI so fast and powerful when it comes to performanc ...

最新文章

  1. 输入空格hdu - 1010 - Tempter of the Bone
  2. 万字长文,最硬核的mysql知识总结
  3. 在python中使用sort_Python中的sort()方法使用基础教程
  4. Java08-day08【API(概述、使用)、String-StringBuilder(概述、构造方法、特点、方法)、StringBuilder和String相互转化】
  5. CentOS 6.5 初始值
  6. 以小见大:如何设计注册登录页?
  7. Gentoo Linux 学习笔记1
  8. 李宏毅机器学习——无监督学习(五)
  9. 更新了 pe_xscan 和 ClosePc
  10. jQuery——常用API
  11. tinder和bumble_发布课程:Tinder,Reddit,Airbnb,Etsy和Uber如何吸引了第一批用户
  12. biostar handbook(十一)|基因组变异的表示形式
  13. HTML、CSS——可伸缩式搜索框
  14. TIA博途中如何通过PLC变量控制开始和停止记录数据?
  15. Windows下通过VNC访问Linux服务器(可视化界面)
  16. Matlab/simulink通信系统仿真入门操作
  17. 请广大编程爱好者加入QQ群5907439
  18. Scrapy-Splash爬取淘宝排行榜(二)
  19. 【Industry digitization】数字化技术正在全球范围内迅猛发展,世界各国和企业纷纷开启数字化转型之路
  20. 机器学习应该准备哪些数学预备知识?

热门文章

  1. Titan XP值不值?一文教你如何挑选深度学习GPU
  2. Redis缓存雪崩/穿透/击穿
  3. MATLAB app designer GUI设计
  4. 猫和计算机连接网络,计算机路由器与猫的连接方法步骤
  5. matlab编程求解一元高次方程
  6. 蓝桥杯练习题 <座次问题> 排列型枚举 next_permutation
  7. java整数类和自然数类的简单实现
  8. 39个大数据可视化工具
  9. 银联支付、支付宝支付和微信支付有什么优势?
  10. R语言:rJava包的安装