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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
deryl1974
Frequent Visitor

Error during Get Reports API

Hi All,

 

I am trying to read all reports in my group using azure add token authorization. Token comes back good but when I try to execute the power bi API i get below error:

 

"The requested name is valid, but no data of the requested type was found

 

Here is my code:

private async Task<string> PostExportRequest(Guid reportId, Guid groupId)
{
try
{
//Export configurations
var paginatedReportExportConfiguration = new PaginatedReportExportConfiguration() { FormatSettings = new Dictionary<string, string>() { { "PageHeight", "14in" }, { "PageWidth", "8.5in" }, { "StartPage", "1" }, { "EndPage", "1" } } };
var exportRequest = new ExportReportRequest { Format = FileFormat.PDF, PaginatedReportConfiguration = paginatedReportExportConfiguration };

//Report and API Urls
var _apiUrl = new Uri("https://analysis.windows.net/powerbi/api/");
var AuthorityUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/<tenentid>";

//Credentials
string clientID = "<client id for my azure app>";
string secret = "<secret>";
var credentials = new Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential(clientID, secret);
var authenticationContext = new AuthenticationContext(AuthorityUrl);
var authenticationResult = await authenticationContext.AcquireTokenAsync("https://analysis.windows.net/powerbi/api", credentials).ConfigureAwait(false);
var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

var pbClient = new PowerBIClient(_apiUrl, tokenCredentials);

// Get a list of Reports inside group.
var reports = await pbClient.Reports.GetReportsInGroupAsync(groupId);


}
catch (Exception ex)
{
}
return null;


}

Has anyone come across this error? Apprecate all the help in advance.

 

Thanks
Lloyd

7 REPLIES 7
v-shex-msft
Community Support
Community Support

Hi @deryl1974,

It seems like you are working with the paginated reports which have been limited usage with the 'get report in group' API. I'd like to suggest you take a look at the official document to know more about these:

Reports - Get Reports In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs

Note: Paginated reports (rdl) don’t have a dataset. As a result, in the API response for paginated reports, the dataset ID value isn’t displayed.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Sheng,

 

Thank you for your response. However I am getting the same error for power bi reports as well.

 

Thanks

Lloyd

 

Hi @deryl1974,

What type of data source do these testing reports use? Connection mode? Please share some more detailed information to help us clarify your scenario and test to reproduce and troubleshoot your issue.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin,

 

I am getting error for all of my reports. Connected to datasource or not. For this particular one, I an using below connection:

 

 

Data Source: sql server stored procedure.

Connection: on prem sql server (using a data gateway to connect)

 

Thanks
Lloyd

 

 

Hi @deryl1974,

Did these data sources work with import mode or direct query mode? AFAIK, current power bi does not support work with stored procedures in direct query mode. If you are working in this scenario, it may affect the API usages.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

After looking at the Inner Exception I noticed the following error. Not sure what is causing this:

 

Message : "The requested name is valid, but no data of the requested type was found." string

NativeErrorCode : 11004 

SocketErrorCode : NoData System.Net.Sockets.SocketError

 

I am not using any data connectivity. Just created test data and populated for testing this scenario.

 

Any help is higly appreciated.

 

Thanks

Lloyd

 

 

Thanks

Lloyd

 

Hi @deryl1974,

Please take a look at the following documents about the export report and correspond limitations if they meet your scenarios:

Export Power BI embedded analytics paginated reports API - Power BI | Microsoft Docs

Export Power BI embedded analytics reports API - Power BI | Microsoft Docs

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.