Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi All,
I have a question. I succesfully included the report in an Modern Page in our Sharepoint Online enviroment. But the frontpage of our sharepoint site is site the Classic Page, which we cannot upgrade to a Modern Page at this point in time. Is it still possible to show a report on the Classic Page? I want to get rid op Datazen, but the only way to do that is by embedding the Report on the frontpage of sharepoint.
With kind regards,
Daan Damhuis
With Power BI's new report web part for SharePoint Online, you can easily embed interactive Power BI reports in SharePoint Online pages. The requirements in order for Embed in SharePoint Online reports to work is that the Power BI web part for SharePoint Online requires Modern Pages. So I am afraid you requirement cannot be achieved currently. Thank you for your understanding.
Reference
https://docs.microsoft.com/en-us/power-bi/service-embed-report-spo
Regards,
Charlie Liao
I undertsnad that the web part doesnt work. BUT what are the other options for embedding in classic pages? Do we need Powerr BI embedded?
Hi, i had the same problem. If "publish to web" is not an option or you want to secure embed on a SharePoint classic page but still have single sign-on, you could add it to a modern page and then iframe the modern page on a classic page. This is what i did below. It will require the modern spfx script editor webpart.
<script type="text/javascript">
if(window.location.href.indexOf('onlyshowpbi=') > -1 && window.location.href.indexOf('onlyshowpbi=0') < 0) {
console.log('Hide all content and show only the PBI embedded iframe fullscreen');
var css = 'body > div, body > span { display: none !important; }',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
head.appendChild(style);
style.type = 'text/css';
style.id = 'pbi_css'
style.appendChild(document.createTextNode(css));
window.frameReadyToDisplay = true;
var checker = function(){
var pbiframe = document.querySelectorAll('iframe[src*=powerbi]')[0];
if(typeof(pbiframe) !== 'undefined') {
var pbiframe = document.querySelectorAll('iframe[src*=powerbi]')[0];
pbiframe.style.border = '0px';
pbiframe.style.width = '100%';
pbiframe.style.height = '100%';
pbiframe.style.margin = '0px';
pbiframe.style.padding = '0px';
document.querySelector('body').appendChild(pbiframe);
}
else {
setTimeout(checker, 1);
}
}
setTimeout(checker, 1);
}
</script>
<!-- Embedded PowerBI report - embedded on a modern SPO page and shown in an iframe so that it can be displayed on a classic page but still single sign-on (modern webpart capability only) -->
<div id="pbiContainer">
<iframe id="pbi" src="https://<tenant>.sharepoint.com/teams/test/SitePages/pbitest.aspx?onlyshowpbi=1" style="display: none; width: 100%; height: 100%;"></iframe>
<script type="text/javascript">
// Check the frame to see if it is ready to be displayed. The frame has some script to hide everything except the PBI report webpart but the script doesn't run until
// the script editor is rendered which may be a second after content is shown... which would produce a flicker. So the frame indicates when it is ready to be shown after CSS has been
// applied
var pbiframechecker = function () {
if (document.getElementById("pbi").contentWindow.frameReadyToDisplay) {
document.getElementById("pbi").style.display = '';
}
else {
setTimeout(pbiframechecker, 25);
}
};
setTimeout(pbiframechecker, 25);
</script>
</div>
The reason the SharePoint embed link only works in a modern powerbi webpart is because there is a window.PostMessage conversation between the modern sharepoint page and the powerbi page. The modern SPO page sends an access token matching what the powerBI site is expecting, though i'm not sure how the modern powerBI webpart comes up with the token. The ideal and faster solution would be to implement this flow on a classic site. If anyone has spent the time please share.
Hi,
You cannot embed Power Bi report onto a classic SharePoint Online page, that is as simple as that.
But what you could do is enable Site Pages feature for the site and then add a site page (which is modern page) and add Power Bi Report web part and add the embed URL.
Regards,
Hari Govind