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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
pbi_vis_dev
New Member

Custom visual: file download API doesn't download the file, the result is false

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?

3 REPLIES 3
apodo01
Frequent Visitor

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.

 

 

 

 

 

 

 

dm-p
Super User
Super User

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:

dmp_0-1678651636123.png

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Adamboer
Responsive Resident
Responsive Resident

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.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.