cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SarahQUL
Frequent Visitor

Can't display a new report

Hi everebody,

 

I have need some help, please.

 

I try to create a report with a Dataset selected by the user. For this, I use the API Rest Power BI. I get the list of datasets, and I display a form, in this form there are the name and the id of dataset. When a dataset is selected, and validate, a new IFrame appear with the report. But my problem is the next: when the IFrame Appear I have a message who tell me : "This content is not available". I haven' any error message in the console, and my code is exalty as the code of microsoft example: https://docs.microsoft.com/en-us/azure/power-bi-embedded/power-bi-embedded-create-report-from-datase....

 

Of the blow, I would like to know, the reasons why I might have this problem. Maybe I miss an important step for displaying this report in create mode?

 

 

Here you can see some screen captures: 

API_error.PNGfonction_create.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft Eric_Zhang
Microsoft

Re: Can't display a new report

@SarahQUL

Embedding a dataset to create a report works in my test. I can create and save a report. In your case, please try to debug the accesstoken used to embed a dataset and decode it at https://jwt.io/. You'll find the workspaceid, datasetid and scopes, please ensure that  all information is correct and scope is "Dataset.Read Workspace.Report.Create"

Capture.PNG

var embedToken= PowerBIToken.CreateReportEmbedTokenForCreation(this.workspaceCollection, workspaceId, datasetid, null, null, "Dataset.Read Workspace.Report.Create");
AccessToken = embedToken.Generate(this.accessKey)

 

A static html testing demo FYI.

<html>

 <script src="../jquery.js"></script>

<script src="../powerbi.js"></script>
 
<script type="text/javascript">
window.onload = function () {   
// Read embed application token from textbox
var txtAccessToken = 'accessToken';
 
// Read embed URL from textbox
var txtEmbedUrl = 'https://embedded.powerbi.com/appTokenReportEmbed';
 
// Read dataset Id from textbox
var txtEmbedDatasetId = 'datasetID';
 
// Embed create configuration used to describe the what and how to create report.
// This object is used when calling powerbi.createReport.
var embedCreateConfiguration = {
    accessToken: txtAccessToken,
    embedUrl: txtEmbedUrl,
    datasetId: txtEmbedDatasetId,
};
 
// Grab the reference to the div HTML element that will host the report
var reportContainer = $('#reportContainer')[0];
 
// Create report
var report = powerbi.createReport(reportContainer, embedCreateConfiguration);  
}
</script>

<div id="reportContainer" ></div>

</html>

 

View solution in original post

2 REPLIES 2
Microsoft Eric_Zhang
Microsoft

Re: Can't display a new report

@SarahQUL

Embedding a dataset to create a report works in my test. I can create and save a report. In your case, please try to debug the accesstoken used to embed a dataset and decode it at https://jwt.io/. You'll find the workspaceid, datasetid and scopes, please ensure that  all information is correct and scope is "Dataset.Read Workspace.Report.Create"

Capture.PNG

var embedToken= PowerBIToken.CreateReportEmbedTokenForCreation(this.workspaceCollection, workspaceId, datasetid, null, null, "Dataset.Read Workspace.Report.Create");
AccessToken = embedToken.Generate(this.accessKey)

 

A static html testing demo FYI.

<html>

 <script src="../jquery.js"></script>

<script src="../powerbi.js"></script>
 
<script type="text/javascript">
window.onload = function () {   
// Read embed application token from textbox
var txtAccessToken = 'accessToken';
 
// Read embed URL from textbox
var txtEmbedUrl = 'https://embedded.powerbi.com/appTokenReportEmbed';
 
// Read dataset Id from textbox
var txtEmbedDatasetId = 'datasetID';
 
// Embed create configuration used to describe the what and how to create report.
// This object is used when calling powerbi.createReport.
var embedCreateConfiguration = {
    accessToken: txtAccessToken,
    embedUrl: txtEmbedUrl,
    datasetId: txtEmbedDatasetId,
};
 
// Grab the reference to the div HTML element that will host the report
var reportContainer = $('#reportContainer')[0];
 
// Create report
var report = powerbi.createReport(reportContainer, embedCreateConfiguration);  
}
</script>

<div id="reportContainer" ></div>

</html>

 

View solution in original post

SarahQUL
Frequent Visitor

Re: Can't display a new report

My token Access is false, I try to change that.

 

Thanks for you response.

 

Sarah.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications