cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Power BI Embedded API ExportToFile returns "Forbidden" error

I'm trying to do an ExportToFile on a report I have displayed in my app using the Power BI Embedded API.  I am using the same code to get token credentials and generate a Power BI Embedded API client object that is working when I display my report, but when I try to call Clent.Reports.ExportToFIleInGroupsAsync, it throws a "Forbidden" exception.

 

var exportRequest = new ExportReportRequest
{
Format = format,
PowerBIReportConfiguration = powerBIReportExportConfiguration
};

// Get token credentials for user
var getCredentialsResult = await GetTokenCredentials();
if (!getCredentialsResult)
{
// The error message set in GetTokenCredentials
return null;
}

var Client = new PowerBIClient(new Uri(ApiUrl), m_tokenCredentials);
var export = await Client.Reports.ExportToFileInGroupAsync(groupId, reportId, exportRequest);

Any thoughts on what I'm doing wrong?

 

-- Tony

2 REPLIES 2
Highlighted
Super User IV
Super User IV

@erosal84 Any chance you are using something like RLS on that report?


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




Highlighted

Nope, no RLS on the report.  To clarify, displaying the report is working fine.  It's a subsequent call to ExportToFile that is generating the error.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.