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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
GianmarcoItaca
New Member

Export Report with ExportToFileInGroupAsync and Bookmarks using State from Frontend

I am trying to apply a bookmark while exporting the report. I have an angular front end and I am using the power-bi-client module to capture the bookmark from the report:

 

var bookmark= await embed.bookmarksManager.capture();
var state= bookmark.state

 Then i pass the state to .NET backend to create a bookmark with the state:

PageBookmark bookmark = new PageBookmark(state:state);

 And finally to call ExportToFileInGroupAsync with the info:

public static async Task<string> PostExportRequest(
string id_execution,
PageBookmark bookmark,
string dataset_id,
Guid reportId,
Guid groupId,
FileFormat format,
PowerBIClient Client,
IList<string> pageNames = null, /* Get the page names from the GetPages REST API */
string urlFilter = null)
{
var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
{
Settings = new ExportReportSettings
{
Locale = "en-us",
},
DefaultBookmark = bookmark, /////////////HERE
Pages = pageNames?.Select(pn => new ExportReportPage(pn)).ToList(),
Identities = new List<EffectiveIdentity>() {new EffectiveIdentity()
{
Roles = new List<string>() { "role1" },
Username = id_execution,
Datasets = new List<string>() { dataset_id }
}
}

};

var exportRequest = new ExportReportRequest
{
Format = format,
PowerBIReportConfiguration = powerBIReportExportConfiguration,
};
try
{
var export = await Client.Reports.ExportToFileInGroupAsync(groupId, reportId, exportRequest);
return export.Id;
}
catch (Exception e)
{
return e.Message;
}

}

The call works without the bookmark, but it returns a generic BadRequest with it. 

 

How am I supposed to pass the bookmark?

1 REPLY 1
lbendlin
Super User
Super User

you can practice your call (and validate the format) here

 

Reports - Export To File In Group - REST API (Power BI Power BI REST APIs) | Microsoft Learn

 

Read about the limitations here

Export Power BI embedded analytics reports API - Power BI | Microsoft Learn

 

(note the limitation on personal bookmarks)

 

NOTE:  The bookmark name may not be what you think it is.  Retrieve the bookmarknames to see what the format is.    Should be bookmark<guid>

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.