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
Anonymous
Not applicable

GenerateToken for dashboard with links to reports in the same workspace

Hello -

I am able to generate token for dashboards that do not have any links embedded just fine, but with anything that has links I get the "InternalServer" error.

var token = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri("https://api.powerbi.com"), token))
{
ODataResponseListDashboard dashboards = client.Dashboards.GetDashboardsInGroup(groupId);
GenerateTokenRequest request = new GenerateTokenRequest("view");
Dashboard dashboard = dashboards.Value.FirstOrDefault(a => a.DisplayName.Contains("Test"));
try
{
EmbedToken embedToken = client.Dashboards.GenerateTokenInGroup(groupId, dashboard.Id, request);
}
catch (Exception ex1)
{
}
}

Any help would be appreciated.

Thanks, Shilpi

5 REPLIES 5
Eric_Zhang
Employee
Employee


@Anonymous wrote:

Hello -

I am able to generate token for dashboards that do not have any links embedded just fine, but with anything that has links I get the "InternalServer" error.

var token = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri("https://api.powerbi.com"), token))
{
ODataResponseListDashboard dashboards = client.Dashboards.GetDashboardsInGroup(groupId);
GenerateTokenRequest request = new GenerateTokenRequest("view");
Dashboard dashboard = dashboards.Value.FirstOrDefault(a => a.DisplayName.Contains("Test"));
try
{
EmbedToken embedToken = client.Dashboards.GenerateTokenInGroup(groupId, dashboard.Id, request);
}
catch (Exception ex1)
{
}
}

Any help would be appreciated.

Thanks, Shilpi


@Anonymous

The code works in my test, I don't get any error when trying to generate embed token for a dashboard with tiles having link to a report in the current workspace.

Capture.PNG

 

For those specific dashboards that lead to the internal server errors in your case, instead of the C# code, can you try to test the REST API GenerateToken with some test tool, like POSTMAN.

 

Anonymous
Not applicable

Thanks @Eric_Zhang, I will try that.

 

Are there any spcial permissions needed for those reports/dashboards?

 

Thanks, Shilpi

Anonymous
Not applicable

Also when I see the picture that you have attached, I realized that when you added the link to your report, the report appeared in the screenshot, where as I see this on my dashboard..

 

LinkedReport.PNG

Anonymous
Not applicable

And I cannot publish the report that I am adding to the dashboard to the web and get an embed code that way, because this report is not meant to be public.

Anonymous
Not applicable

Hello -

 

I am able to generate token for dashboards that do not have any links embedded just fine, but with anything that has links I get the "InternalServer" error.

 

var token = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri("https://api.powerbi.com"), token))
{
ODataResponseListDashboard dashboards = client.Dashboards.GetDashboardsInGroup(groupId);

GenerateTokenRequest request = new GenerateTokenRequest("view");

Dashboard dashboard = dashboards.Value.FirstOrDefault(a => a.DisplayName.Contains("Test"));

try
{
EmbedToken embedToken = client.Dashboards.GenerateTokenInGroup(groupId, dashboard.Id, request);

}
catch (Exception ex1)
{
}

}

 

Any help would be appreciated.

 

Thanks, Shilpi

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.