Forum Discussion
vospitannikov
9 years agoHelper I
Embed group report problem
I'm trying to integrate PowerBI report (located in group) into my page using iframe I've registered AD application I can query list of reports from the server side But when I'm trying to use recei...
supermulder
9 years agoFrequent Visitor
Thank you. I finally found a solution.
I´m not using the powerbi-javascript-library anymore, regarding of the issue that it is not possible to set the groupid of a report at the moment.
Instead i use the following javascript-code (based on the provided example).
<script>
function loadReportIntoIframe(reportId,groupId,iframeId){
var iframe = document.getElementById(iframeId);
var iframeUrl = 'https://app.powerbi.com/reportEmbed?reportId='+reportId;
if (groupId){
iframeUrl = iframeUrl + '&groupId=' + groupId;
}
iframe.src=iframeUrl;
iframe.onload = postActionLoadReport;
}
// Post the access token to the IFrame
function postActionLoadReport() {
// Construct the push message structure
// this structure also supports setting the reportId, groupId, height, and width.
// when using a report in a group, you must provide the groupId on the iFrame SRC
var m = {
action: "loadReport",
accessToken: 'YOUR_AAD_ACCESSKEY'
};
message = JSON.stringify(m);
// push the message.
iframe = document.getElementById('iFrameEmbedReport');
iframe.contentWindow.postMessage(message, "*");;
}
</script>Sample:
Loading a report from your worksspace:
<a href="javascript:loadReportIntoIframe('REPORT_ID','','IFRAME_ID')" >REPORT NAME</a>Loading a report from group:
<a href="javascript:loadReportIntoIframe('REPORT_ID','GROUP_ID','IFRAME_ID')" >REPORT_NAME</a>Next i will try to do the same with powerbi dashboards ...
- BjoernLueers9 years agoAdvocate II
We have exactly the same problem. Embedding of personal reports still works perfectly (except in Chrome) but since recently group reports are not working anymore. We have been using the approach to add a groupID parameter to the report Url but we also tried to set group and report ID via post message with the same negative result.