Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
lukepaw
New Member

createReport does not expose same API as embed

Hi

 

I am embedding a new report using the `powerbi.createReport` function.
The embed works fine - but I cannot access functions such as `getPages()` on the returned object.

It appears the returned object is a very lackluster compared to the one returned by `embed()`.

Is that intentional?

 

I expected to have mostly the same API available as when editing an existing report - given the user can add pages, add visuals and do other operations just fine within the iframe - even before the report is saved.

 

Currently, I need to save the report first, then embed it - to get access to the needed functionality.

Perhaps I am missing something, but I failed to find any docs or samples regarding working with a new report from code.

Any ideas?

 

Regards,
Luke

 

1 REPLY 1
Anonymous
Not applicable

Hi  @lukepaw

Here I found a post with similar problem like yours and I hope it could help you.

Try this code:

var report = powerbi.embed(reportContainer, config); 
report.on("rendered", function (event) { // do stuff here like get pages, export data, apply filters or whatever it is you want to do to manipulate the report 
report.getPages().then((pages) => { pages[0].getVisuals().then((visuals) => (d = visuals)); }); var v = d[1].exportData(models.ExportDataType.Summarized, 100); }); 

For more details: Not getting report.getPages in Embedded Power BI report

For reference: Handling Events

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors