Forum Discussion

MaartenInc's avatar
MaartenInc
Frequent Visitor
4 years ago
Solved

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).

 

But there doesn't seem to be property or parameter to set something for Tiles or Dashboard. There is no class "GenerateTokenRequestV2Dashboard". I can't find any entry points for a previous or later version then V2.

 

I feel like I am missing something. Is this currently not support within the Nuget package for .NET core, and should I call these APIs via a HttpClient to generate these embed tokens?

 

Thanks,

  •  

     

                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

  • MaartenInc's avatar
    MaartenInc
    Frequent 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.