The property includeHiddenPages is not working while calling exporttofile API in PowerBI

Viewed 22

I have embedded powerbi into my application (embed for customer). Whenever I use exporttofile API to export powerbi reports, it always includes the hidden pages. As per the exporttofile API documentation, if we set IncludeHiddenPages to False, it will exclude the hidden pages. But it is not working.

'''var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
            {
                Settings = new ExportReportSettings
                {
                    Locale = "en-us",
                    IncludeHiddenPages = false
                },
                Pages = pageNames?.Select(pn => new ExportReportPage(pn)).ToList()
            };
'''

Please note that, I have been used .NET Core to embed powerbi into my application.

1 Answers

ExportReportRequest contains PowerBIReportExportConfiguration property where we can control to include hidden pages or not. Here is the code

var exportRequest = new ExportReportRequest {

      Format : ExportFileFormat,

      powerBIReportExportConfiguration = new PowerBIReportExportConfiguration

            {
                Settings = new ExportReportSettings
                {
                    Locale = "en-us",
                    IncludeHiddenPages = false
                },
                Pages = pageNames?.Select(pn => new ExportReportPage(pn)).ToList()
            };};

Export export = pbiClient.Reports.ExporttofileInGroup(workspaceId, ReportId, exportRequest);

References:

https://learn.microsoft.com/rest/api/power-bi/reports/export-to-file-in-group#exportreportrequest

Related