Forum Discussion

mick22's avatar
mick22
Frequent Visitor
3 years ago
Solved

Embed for Customer Portal - Request exceeds the maximum number of datasets - 50

I have developed a website (based on the Embed for Customers example) that based on the user that is logged in it shows them all of their power bi reports selectable by a dropdown list.  I'm using a service principal which has access to the Premium Workspaces.  We are using a Premium Capacity.  If a user has less than 50 reports, the website works fine.  When a user has more than 50 reports I'm getting the following error:

 

Error

            Status: BadRequest (400)
Response: {"error":{"code":"InvalidRequest","message":"Request exceeds the maximum number of datasets - 50"}}
RequestId: dfd60c00-f508-44e1-a55d-04561c8ae450

 

This error occurs when the last line of code executes and it tries to generate the token.   Any ideas of what I may be doing incorrect?  My understanding is there is no limitations on generating tokens in a premium capacity.

 

 

                // Create a request for getting Embed token 
                // This method works only with new Power BI V2 workspace experience
                var tokenRequest = new GenerateTokenRequestV2(

                    datasets: datasets,

                    reports: reports,

                    targetWorkspaces: targetWorkspaceIds != null ? targetWorkspaces : null
                );

                // Generate Embed token
                var embedToken = pbiClient.EmbedToken.GenerateToken(tokenRequest);

 

 

  • Hi,

     

    Embed token is indeed limited for the number of artifacts (reports/datasets/etc.) that it can allow access to, and it seems that you've hit one of the limitations.

    For showing the list of reports you don't actually need the embed token. I guess you only need it when you actually want to render the selected report. Maybe generating a token after the user chooses the report from the list (only for the specific report) can be a solution?

2 Replies

  • AmosHersch's avatar
    AmosHersch
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi,

     

    Embed token is indeed limited for the number of artifacts (reports/datasets/etc.) that it can allow access to, and it seems that you've hit one of the limitations.

    For showing the list of reports you don't actually need the embed token. I guess you only need it when you actually want to render the selected report. Maybe generating a token after the user chooses the report from the list (only for the specific report) can be a solution?

  • mick22's avatar
    mick22
    Frequent Visitor

    Hello AmosHersch,

     

    That's an interesting thought, however different than the Embed For Customers project template does it and thus the reason I hit this error.  I'm not sure how much work it would take to recode it to get the token AFTER the report is selected in the dropdown but I may look at that!  Thank you.