Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all!
I try to download file from custom visual with File Download API (https://learn.microsoft.com/en-us/power-bi/developer/visuals/file-download-api#how-to-use-the-file-d.... But the result from exportVisualsContent call will false at any time.
Here is my code:
this.host.downloadService
.exportVisualsContent("sample text", "data.txt", "txt", "txt file")
.then((result) => {
console.log("download result", result);
})
.catch((reason) => {
console.error(reason);
});
It fired the success callback in then, but the result is false.
I use 4.6.0 version of PowerBI Visuals API.
Can you help what the problem might be?
Hi! Please excuse my english.
I had the same problem and successfully solved it.
Along with configuring the PBI tenant, my problem was... the "ExportContent" privilege was missing in the "capabilities.json" file.
Please, refer to this page: https://learn.microsoft.com/en-us/power-bi/developer/visuals/capabilities#example-of-a-privileges-de...
I fixed my mistake thanks to this API: https://learn.microsoft.com/en-us/power-bi/developer/visuals/permissions-api
I hope this will help.
Adrian.
Hi @pbi_vis_dev,
Your code snippet looks okay for what it looks like you're attempting to do. If you're getting the success callback but your result is false, then my thoughts are that Power BI is rejecting the download due to tenant settings. What's worth checking is if you have the ability to download data from custom visuals enabled at a tenant level:
This is usually disabled by default, and if you're not a tenant admin, you may need to work with who is to set this up.
Once enabled, you'll need to wait about 15 minutes or so (and possibly reload your current report/debugging session) to pick up the updated tenant setting.
Regards,
Daniel
EDIT: link to relevant admin doc
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
One possible solution could be to add an additional parameter to the exportVisualsContent method to specify the export data format. For example:
this.host.downloadService .exportVisualsContent("sample text", "data.txt", "txt", "txt file", "rawText") .then((result) => { console.log("download result", result); }) .catch((reason) => { console.error(reason); });
In this case, the "rawText" format is specified, which should return the text content of the file as a string. It's possible that the default export format is not compatible with the file type or data being exported, which could cause the false result. By specifying the export format, you can ensure that the correct data is being returned. Additionally, make sure that the file type and extension being specified are correct and match the data being exported.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
7 | |
7 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |