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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nuthanm
Frequent Visitor

Power BI Rest API - Export the current Selection of Page inside Report using C#

We integrated PowerBI report in our web application using Power BI Rest API and embeded that report using ReactJS library.

We have a new requirement to export the report in PDF and PPTX.

Scenario 1 : If user select certain area in a page and in downloaded report it should only highlight data in PDF/PPTX.

This is working when i downloaded from app.powerbi.com portal but how we can acheive programatically?

Question: How to get the current selection of area from a page using C# Power BI Rest API?

 

Scenario 2: If report has more than one page and user wants only certain page to download with either current selection/default values

Question: How to get and pass current page / all with current selection/default values using C# Power BI Rest API

 

 

 

 

2 REPLIES 2
Icey
Community Support
Community Support

Hi @nuthanm ,

 

There is a post explains how to querying the Power BI REST API directly with C#. Therefore, you can refer to it to export reports. Here are the functions to export Power BI Reports:

Reports - Export To FileExports the specified report from "My Workspace" to the requested format.

Reports - Export To File In GroupExports the specified report from the specified workspace to the requested format.

 

For more details, please check this document: Export Power BI embedded analytics reports API - Power BI | Microsoft Docs.


Limitations

  • The report you're exporting must reside on a Premium or Embedded capacity.
  • The dataset of the report you're exporting must reside on a Premium or Embedded capacity.
  • For public preview, the number of Power BI exports per hour is limited to 50 per capacity. An export refers to exporting a single visual or a report page with or without bookmarks, and doesn't include exporting paginated reports.
  • Exported reports cannot exceed a file size of 250 MB.
  • When exporting to .png, sensitivity labels are not supported.
  • The number of exports (single visuals or report pages) that can be included in an exported report is 50 (this doesn't include exporting paginated reports). If the request includes more exports, the API returns an error and the export job is canceled.
  • Personal bookmarks and persistent filters are not supported.
  • The Power BI visuals listed below are not supported. When a report containing these visuals is exported, the parts of the report that contain these visuals will not render, and will display an error symbol.
    • Uncertified Power BI visuals
    • R visuals
    • PowerApps
    • Python visuals
    • Visio

 


However, it may not supported to "get the current selection of area from a page". It currently support to use reportLevelFilters in PowerBIReportExportConfiguration to export a report in a filtered condition.

 

Reference: Export Power BI report to file (preview)#Filters

 

Here are some samples:  Export Power BI report to file (preview)#Code examples

 

 

Best Regards,

Icey

 

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

nuthanm
Frequent Visitor

Thanks @Icey  for replying.

I gone through the above links and we tried those endpoints but the output what we seen are not expected one.

 

One conclusion from your reply is "Can't acheivable partial selection of chart in a page from a report using C# Power BI Rest API".

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.