cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MaheshMole
Frequent Visitor

Power BI Bookmark for Embedded report - Capture api not working

We are trying to show all bookmarks, capture and apply using Power BI Java scripts bookmark API (Bookmarks Java Script API ) in our application which uses embedded reports.

The capture API is not working for  power BI embedded reports. Do we know how we can capture the bookmark in Power BI Embedded?

 

We can apply and show "Report Bookmarks" using Power BI Java scripts in embedded reports.

The documentation (https://azure.microsoft.com/en-us/updates/power-bi-embedded-bookmarks-api ) shows we can capture but its not working and we don't have any error.

5 REPLIES 5
kohder
Frequent Visitor

@AbdelSolis 


Check the version of you powerbi-client package.

In my case I found that an environment running version 2.15.1 was raising this exception.

 

Not sure what the problem is with this version, but if you explicitly update your package.json to target 2.14.1 the problem seems to disappear.

AbdelSolis
Frequent Visitor

Hi, guys.

I'm trying to export to a pdf file a power bi embedded report in a custom app with the current values of the report but when I use this function: let capturedBookmark = report.bookmarksManager.capture();  this error shows to me:

message: "captureBookmarkFailed", detailedMessage: "Invalid bookmark request", level: 3. 

So I was wondering if anybody had the same error and how did you solve it?

 

Thanks in advance.

v-lid-msft
Community Support
Community Support

Hi @MaheshMole ,

 

Does this api not work on your side? Based on this document, it should be saved in application database and will be invalid after report changed

 

15.jpg


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

These call returns some objects with state and bookmark name

 

 

 // Capture the current view
    this.embedReport.bookmarksManager.capture().then( capturedBookmark  =>
    {
      // Applied previously captured state
      this.embedReport.bookmarksManager.applyState(capturedBookmark.state).then( r =>{
        debugger;
      }).catch( err => {
        console.log("Error while capture bookmark" +  err);
      });
    });

 

 

But when I call getBookmarks, it doesn't return any captured bookmarks. This getBookmarks only is not working. We are able to apply bookmark using captured state in different session. 

Do you know how we can get this getBookmarks API working? 

 

 

 this.embedReport.bookmarksManager.getBookmarks().then( bookmarks => {
            bookmarks.forEach( b => console.log("Bookmark Name:" + b.name + ", State:" + b.state));
          }).catch( err => {
            console.log("Error while getBookmarks Error:" +  err);
          });

 

Hi,

 

Did you solved the problem?

I tried to use Capture Bookmarks in a report embedded in  LocalHost using the steps from here: https://app.powerbi.com/embedsetup/AppOwnsData?session_id=7f09dbe3-8fc1-45c1-ac0c-adb3a028b171

I create in MS VIsual Studio a new file script where I coped the code from here: https://github.com/microsoft/PowerBI-JavaScript/blob/master/demo/v2-demo/live_showcases/bookmarks/sh...

I reffer this script in EbedReport.cshtml (<script src="~/scripts/showcase_bookmarks.js"></script>), but when I run the code nothing change in the page where the report is embedded.

How should I proceed?

 

Thanks!

 

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors