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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sanjeevgaut
Frequent Visitor

Reports - Export To File , with filter options and pageName not working

Hi 

 

I am trying to export report , with applied filter and for some page. i am getting error "Operation returned an invalid status code 'BadRequest'"

Below is my code.

 

var urlFilter = "Distry=CMC";
ExportReportPage pages1w3 = new ExportReportPage("ReportSection0");
IList<ExportReportPage> pageNames = new List<ExportReportPage> { pages1w3 };

var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
{
Settings = new ExportReportSettings
{
Locale = "en-us",
},
// Note that page names differ from the page display names
// To get the page names use the GetPages REST API
Pages = pageNames,
// ReportLevelFilters collection needs to be instantiated explicitly
ReportLevelFilters = !string.IsNullOrEmpty(urlFilter) ? new List<ExportFilter>() { new ExportFilter(urlFilter) } : null,

};

var exportRequest = new ExportReportRequest
{
Format = FileFormat.ACCESSIBLEPDF,
PowerBIReportConfiguration = powerBIReportExportConfiguration,
};

var export = client.Reports.ExportToFile(ReportId, exportRequest);

 

Any help appreated..

3 REPLIES 3
lbendlin
Super User
Super User

Currently you can only supply ONE report level filter.

lbendlin
Super User
Super User

You have to use the report page ID, not the name.  Use the API sandbox to test your API calls.

 

Reports - Export To File - REST API (Power BI Power BI REST APIs) | Microsoft Docs

@lbendlin thanks for your response. I am able to get single page. but filtering is not applying..Any suggestions.. I want  to apply multiple filter options.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.