March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi all,
I'm using the power BI C# web api Version 4.1.13 to export a report from our Power BI Tenant to a PDF.
I'm able to authenticate and get a bearer token successfully, but I'm running into the same error on the ExportToFileAsync and ExportToFileInGroupAsync calls, no matter what I pass it throws this error - System.NullReferenceException: 'Object reference not set to an instance of an object.'
Here's my code, am I missing anything obivous here? This is the first time I've used this API.
Thank you for any help!
try
{
var exportRequest = new ExportReportRequest
{
Format = format
};
if(_currentAccessToken == null)
await Authenticate();
// The 'Client' object is an instance of the Power BI .NET SDK
var export = await client.Reports.ExportToFileInGroupAsync(reportId, groupId, exportRequest);
// Save the export ID, you'll need it for polling and getting the exported file
return export.Id;
}
catch
{
throw;
}
My problem was that I was not awaiting the full call stack, so it was sending my client to the garbage collector.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
8 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
10 | |
3 | |
2 | |
2 | |
2 |