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
ConstantinL
Regular Visitor

Exporting PowerBI report with bookmark information no longer working

Hello,

 

We are embedding PowerBI reports in our Angular 5 single page application (SPA). We use the powerbi-client npm package. We also provide the option to users to export these reports. The export is requested through a set of ASP.NET REST endpoints that use the Microsoft.PowerBI.Api NuGet package to interact with the actual PowerBI server. Our code is adapted from this example https://docs.microsoft.com/en-us/power-bi/developer/embedded/export-to
In order to maintain user selected filters inside the exported PDF we pass in the bookmark state we get from the embedded report.
In the SPA we call report.bookmarksManager.capture() to get the powerbi.models.IReportBookmark object and we pass the bookmark Name and State when starting the export.
This worked exactly as expected until yesterday.
We can export reports as long as we don't specify bookmark information. This is not ok in our case as most use cases involve exporting with filters to highlight data.
When we specify bookmark information, the call to ExportToFileInGroupAsync is successful and the export status reported is NotStarted. Subsequent calls to GetExportToFileStatusInGroupWithHttpMessagesAsync return a 200 OK response but the status is reported as Failed a null RetryAfter value which indicates a permanent failure. No additional information about the failure is provided and I was not able to find a way to get more infromation about what caused the failure.

I was not able to find a method similar to PowerShell MicrosoftPowerBIMgmt.Profile.Resolve-PowerBIError inside the Microsoft.PowerBI.Api NuGet package to get more information about the failure.
We have tried updating the PowerBI libraries we use, but this has not fixed the issue.
Has there been a change to PowerBI recently that could cause this issue or restrict exporting functionality?

 

Thank you

1 ACCEPTED SOLUTION
ConstantinL
Regular Visitor

Hi Greg

 

We are embedding the reports in the frontend app based on this example.

https://medium.com/@abhijeetpandhe/using-power-bi-embedded-with-angular-and-node-application-55d54c4...

The key section is:

let config: pbi.IEmbedConfiguration = {
type: 'report',
tokenType: pbi.models.TokenType.Embed,
accessToken: Token.token,
embedUrl: embedUrl,
id: embedReportId,
filters: [],
settings: settings
};
let reportContainer = this.reportContainer.nativeElement;
let powerbi = new pbi.service.Service(pbi.factories.hpmFactory, pbi.factories.wpmpFactory, pbi.factories.routerFactory);
this.report = powerbi.embed(reportContainer, config);

 

We then capture bookmark state as descibed here

https://github.com/Microsoft/PowerBI-JavaScript/wiki/Bookmarks#capture-and-get-a-current-view-as-a-b...

 

The captured state (which is just a string) is then passed to the PowerBI .NET SDK method ExportToFileInGroupAsync as part of the PowerBIReportExportConfiguration that is necessary.

 

Our reports have multiple pages as well and the export works as expected. All pages are exported as highlighted.

We use 

settings: {
        filterPaneEnabled: false
      }
in our embed configuration to hide the filter panel on the left of the report as we noticed that the captured bookmarks dont work if the filters on the left are present.

 

Best regards,

Constantin

View solution in original post

4 REPLIES 4
Giorgi1989
Advocate II
Advocate II

As of today this feature is still unsupported by PBI. I have submitted an idea to Microsoft on this. Please, vote it up so that Microsoft engineers take note of it and do something about it: Microsoft Idea (powerbi.com) 

ConstantinL
Regular Visitor

Hi Greg

 

We are embedding the reports in the frontend app based on this example.

https://medium.com/@abhijeetpandhe/using-power-bi-embedded-with-angular-and-node-application-55d54c4...

The key section is:

let config: pbi.IEmbedConfiguration = {
type: 'report',
tokenType: pbi.models.TokenType.Embed,
accessToken: Token.token,
embedUrl: embedUrl,
id: embedReportId,
filters: [],
settings: settings
};
let reportContainer = this.reportContainer.nativeElement;
let powerbi = new pbi.service.Service(pbi.factories.hpmFactory, pbi.factories.wpmpFactory, pbi.factories.routerFactory);
this.report = powerbi.embed(reportContainer, config);

 

We then capture bookmark state as descibed here

https://github.com/Microsoft/PowerBI-JavaScript/wiki/Bookmarks#capture-and-get-a-current-view-as-a-b...

 

The captured state (which is just a string) is then passed to the PowerBI .NET SDK method ExportToFileInGroupAsync as part of the PowerBIReportExportConfiguration that is necessary.

 

Our reports have multiple pages as well and the export works as expected. All pages are exported as highlighted.

We use 

settings: {
        filterPaneEnabled: false
      }
in our embed configuration to hide the filter panel on the left of the report as we noticed that the captured bookmarks dont work if the filters on the left are present.

 

Best regards,

Constantin

ConstantinL
Regular Visitor

Hello,

 

We were able to fix the issue.

We upgraded powerbi-client npm package from 2.8.0 to 2.14.1 and we are sending in the bookmark state alone when calling ExportToFileInGroupAsync.

 

It is not clear why before 2020-10-07 exporting worked as intended when we sent in both BookmarkName and BookmarkState and now it only works with BookmarkState alone.

It is not clear why the bookmark state alone generated by version 2.8.0 of powerbi-client does not work while the bookmark state generated by 2.14.1 works.

An explanation/documentation update would be appreciated.

 

It would make debugging issues like these a lot easier if the return value from GetExportToFileStatusInGroupWithHttpMessagesAsync would contain details about the cause of the failure.

 

Thank you

Hi ConstantinL, we have the same goal - to export an embedded report *in its current filtered state* to PDF.  But haven't tried coding this yet because I don't understand the bookmarking.  I thought bookmarks are page-specific.  Our reports have multiple pages and we want the export to include all.  Is there any code you could share for this functionality?  Thanks, Greg.

(My 2nd attempt; apologies if this post appears twice!)

 

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.