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
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
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.

Top Solution Authors
Top Kudoed Authors