Forum Discussion
C# Embed dashboard and tiles missing in dot.net core api?
Hello,
I'm using the Nuget package from https://github.com/microsoft/PowerBI-CSharp (v4.0.6/latest) within my C# projects to embed reports. These are "for your customer" scenarios. My projects are .net core Rest APIs. The front-end is a seperate React website. Embedding Reports works fine as documented.
According to the API documentation (dashboards-generate-token-in-group & generate-embed-token ) of EmbedToken, I should be able to also embed Dashboards and Tiles into my application. But I can't find a way to generate an embed token within the API methods available.
var identities = await CreateEffectiveIdentities(...);
var pbiDashboard = pbiClient.Dashboards.GetDashboard(workspaceGUID, dashboardGUID);
var tokenRequest = new GenerateTokenRequestV2(
datasets: null,
reports: null,
targetWorkspaces: new List<GenerateTokenRequestV2TargetWorkspace>() { new(worksapceGUID) },
identities: identities
)
var result = await pbiClient.EmbedToken.GenerateTokenAsync(tokenRequest);
To generate a Report token, I provide my datasets and reports (GenerateTokenRequestV2Report).
var p = new GenerateTokenRequest(TokenAccessLevel.View); pbiClient.Dashboards.GenerateTokenAsync(request.WorkspaceId, pbiDashboard.Id, p);As I finished, this question. I found I can use the old 'v1' with following code.
1 Reply
- MaartenIncFrequent Visitor
var p = new GenerateTokenRequest(TokenAccessLevel.View); pbiClient.Dashboards.GenerateTokenAsync(request.WorkspaceId, pbiDashboard.Id, p);As I finished, this question. I found I can use the old 'v1' with following code.