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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
adeeln
Post Patron
Post Patron

Export to file API with Current Values

Hi Experts,

I'm working on Power BI Embedded API. I've been embedded in a report on my web application.

Now my client has a requirement to do export in PDF feature with the default state/current values/selected values/filtered values of the report.

Example: The same scenario like, If we see on Power BI service open any report go to File > Export to PDF as shown in the below image

 

export file.png

 

a pop-up will come to ask you to export with current values (means filters/selection that you've applied on the report) or default values (default state of report nothing selected). So in case of current values Power BI service export the report as expected behavior, with filtered data of the report.

 

Export with Current Values.png

 

But in API I couldn't see this option. I'm following this link to export the power bi embedded report to PDF.

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exporttofileingroup

But I'm unable to see current values options in API.

Please help how can I do export report through API with current values as shown in the above images.

Thanks

 

1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @adeeln 

 

The option won't prompt automatically when you use the API, did you specify the export content in the JSON body?

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exporttofileingroup#powerbireportexportco...

Note that:

You can use the exportToFile API to programmatically export a report in a specific state, after applying filters to it. This is done using Bookmarks capabilities. To export a report using bookmarks, use the bookmarks JavaScript API.

For example, you can use the bookmark's capturedBookmark.state method to capture the changes a specific user made to a report, and then export it in its current state.

Personal bookmarks and persistent filters are not supported.

 

Here're blogs for your reference:

https://blog.crossjoin.co.uk/2020/04/25/calling-the-power-bi-export-api-from-power-automate-part-1-c...

https://blog.crossjoin.co.uk/2020/04/27/calling-the-power-bi-export-api-from-power-automate-part-2-c...

 

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

View solution in original post

4 REPLIES 4
shubh43
Regular Visitor

Hi,

 

I'm trying below mentioned request for export report with current values but API is throwing error, I appreciate if somebody help me to solved this, i need to fix this ASAP.

 

API Endpoint:

https://api.powerbi.com/v1.0/myorg/groups/{groupid}/reports/{reportid}/ExportTo

 

Request:

{
"format": "PDF",
"powerBIReportConfiguration": {
"settings": {
"locale": "en-US",
"excludeHiddenPages": "false"
},
"defaultBookmark": "H4sIAAAAAAAAA+1deW8bR5b/KgSB3cwASlD3.."
}
}


Response:
{
"error": {
"code": "BadRequest",
"message": "Bad Request",
"details": [
{
"message": "Error converting value \"H4sIAAAAAAAAA+1deW8bR5...",
"target": "request.powerBIReportConfiguration.defaultBookmark"
}
]
}
}

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-diye-msft
Community Support
Community Support

Hi @adeeln 

 

The option won't prompt automatically when you use the API, did you specify the export content in the JSON body?

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exporttofileingroup#powerbireportexportco...

Note that:

You can use the exportToFile API to programmatically export a report in a specific state, after applying filters to it. This is done using Bookmarks capabilities. To export a report using bookmarks, use the bookmarks JavaScript API.

For example, you can use the bookmark's capturedBookmark.state method to capture the changes a specific user made to a report, and then export it in its current state.

Personal bookmarks and persistent filters are not supported.

 

Here're blogs for your reference:

https://blog.crossjoin.co.uk/2020/04/25/calling-the-power-bi-export-api-from-power-automate-part-1-c...

https://blog.crossjoin.co.uk/2020/04/27/calling-the-power-bi-export-api-from-power-automate-part-2-c...

 

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

Thanks @v-diye-msft, pretty much clear solution you've provided.

One more question, Is embedded Q&A supports ExportToFile?

Can you also look into these Posts, please?

https://community.powerbi.com/t5/Developer/Export-embedded-Q-amp-A-results-to-PDF/m-p/1378432
https://community.powerbi.com/t5/Developer/Export-embedded-Q-amp-A-results-to-PDF/m-p/1371667#M25738

 

Thanks

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors