I have a web app that shows embedded PowerBI reports. Recently, with help of this link, I've added export of the PowerBI report to PowerPoint. Everything works fine, except the fact that the export is not taking into account at what level of detail the user was looking at. (e.g. he opened the report, but changed the selected tab and went two levels deep from what is shown by default).
I think that this can be addressed with Bookmark info, more details here, I've managed to get the bookmark info, but I can't find any info on how to make the report export take account of this bookmark info.
Do you guys have any link or hint how this can be achieved? Thank you!
LE with code:
Server code(few approaches and their result):
With providing DefaultBookmark I get an empty PowerPoint file.
var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
{
Settings = new ExportReportSettings
{
Locale = "en-us",
},
Identities = new[] { ei },
DefaultBookmark = new PageBookmark(name: bookmarkName, state: reportState),
};
With providing Pages with a PageBookmark based on bookmarkState I get the following error: {"error":{"code":"InvalidRequest","message":"Export report with page names which does not exist in the report is not supported"}}
var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
{
Settings = new ExportReportSettings
{
Locale = "en-us",
},
Identities = new[] { ei },
Pages = new[] { new ExportReportPage(bookmark: new PageBookmark(state: bookmarkState)) },
};
With providing Pages with a PageBookmark based on bookmarkName I get the following error: {"error":{"code":"InvalidRequest","message":"Export report with page names which does not exist in the report is not supported"}}. Same as for the second approach.
var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
{
Settings = new ExportReportSettings
{
Locale = "en-us",
},
Identities = new[] { ei },
Pages = new[] { new ExportReportPage(bookmark: new PageBookmark(name: bookmarkName)) },
};
Same bad request error if I provide both name and bookmark in the ExportReportPage bookmark.
Client code:
async reportBookmark(): Promise<models.IReportBookmark> {
return this.report.bookmarksManager
.capture()
.then(value => {
return value;
})
.catch(() => {
return null;
});
}
After quite a break and some help I realised that the problem was between my web app and my api. I was sending the bookmarkState via the QueryParameters in the requests and some characters were changed or removed. Sending it via the body worked perfectly. Small mention, this is how the export configuration looked in the end:
var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
{
Settings = new ExportReportSettings
{
Locale = "en-us",
},
Identities = new[] { ei },
DefaultBookmark = new PageBookmark(state: reportState),
};