Forum Discussion
ExportTo API: Locale setting not used
I'm using this API to export an embedded report to pdf and powerpoint: https://docs.microsoft.com/en-us/power-bi/developer/embedded/export-to
My users are based in the netherlands so I choose to hardcode 'nl-NL' as the locale for now. Unfortunately this setting does not result in a pdf with values in dutch culture settings (date and number formatting).
The (embedded) report is rendered correctly and switching my browsers culture also changes the formatting.
I've tried different locale strings: "nl", "nl-NL" and "nl-nl"
My code looks like this:
var effectiveIdentities = GetEffectiveIdentities(groupId, report.DatasetId);
var powerBiReportExportConfiguration = new PowerBIReportExportConfiguration
{
Settings = new ExportReportSettings
{
Locale = "nl-nl",
IncludeHiddenPages = false
},
Identities = effectiveIdentities,
Pages = pages.OrderBy(x => x.Order).Select(pn => new ExportReportPage(pn.Name)
{
Bookmark = new PageBookmark(state: filters)
}).ToList()
};
var paginatedReportExportConfiguration = new PaginatedReportExportConfiguration(effectiveIdentities);
return pbiClient.Reports.ExportToFileInGroup(groupId,
reportId,
new ExportReportRequest(fileFormat, powerBiReportExportConfiguration, paginatedReportExportConfiguration));
What am I doing wrong? Or is this a bug in the API?
We suspect that there's an issue with locale in "Export to File" REST API when your report resides on a Gen1 capacity.
We recommend upgrading the capacity to Gen2 where this feature works as expected.
7 Replies
- AmosHerschMicrosoft Employee
Hi,
Please don't create an export request with both powerbiReportExportConfiguration and paginatedReportExportConfiguration. you should specify only one of them based on the type of your report.
I verified Locale is working as expected.
Thanks,
Amos
- emouritsNew Member
It's still not working. I've removed everything non essential to simplify things:
var effectiveIdentities = GetEffectiveIdentities(groupId, report.DatasetId); var powerBiReportExportConfiguration = new PowerBIReportExportConfiguration { Settings = new ExportReportSettings { Locale = "nl-nl", IncludeHiddenPages = false }, Identities = effectiveIdentities, }; return pbiClient.Reports.ExportToFileInGroup(groupId, reportId, new ExportReportRequest(fileFormat, powerBiReportExportConfiguration));- AmosHerschMicrosoft Employee
I don't see a reason it won't work for you, but it might help to see the request body as it was sent in the network (for example using fiddler traces).
Also if you can please share the request ID as returned from Power BI it might help us find the reason.
- emouritsNew Member
The ID of the Export is: MS9CbG9iSWRWMi1lODA3ZjEzZC1lZmEwLTQ3MzktYmJhYS05Mjg3MzE4MTFkOWNPU28zVEx4THB1RGF5eVd6NWFkM1JqSzJMWUtNVTVZY21WY3M0MFZUaWFjPS4=
I'll try and get the Fiddler trace working and respond with that later.