Forum Discussion
Embedded paginated report with PowerBI dataset
- 4 years ago
Hi JAnder ,
The way I am using for obtaining the dataset ID programatically is by calling "Reports - Get Datasources" API https://docs.microsoft.com/en-gb/rest/api/power-bi/reports/get-datasources-in-group the datasource representing the Power BI Dataset will have in the ConnectionDetails.Database something like
sobe_wowvirtualserver-<DatasetID> .Regarding code sample, I don't think there's a code sample for this specific case, but any sample for embedding RDL report should work, besides the change in generateToken request which should look similar to this: - 4 years ago
I posed a code sample here that shows how to get the embed token using the Microsoft.PowerBi.APi nuget: Solved: Re: Paginated Report embedding using a Power BI Da... - Microsoft Power BI Community
Can you show me your code?
So it ends up looking like this and is working for now showing the reports. I should say I dont create the report or do the Power BI admin stuff, so there may be settings which now cause me to leave out the identity.
I did try using dynamic binding with this but it seems the token request always needs the datasetId used when creating the report. If I supply both (original and one I want to use) it seems to work but I only tested that against a dataset copy, needs more work to know if it is binding to correct dataset.
var reports = new List<GenerateTokenRequestV2Report>() { new GenerateTokenRequestV2Report(report.Id) };
var datasets = new List<GenerateTokenRequestV2Dataset>() { new GenerateTokenRequestV2Dataset(datasetId, XmlaPermissions.ReadOnly) };
var workspaces = new List<GenerateTokenRequestV2TargetWorkspace>() { new GenerateTokenRequestV2TargetWorkspace(groupId) };
var tokenRequest = new GenerateTokenRequestV2(datasets, reports, workspaces, null);
var embedToken = client.EmbedToken.GenerateToken(tokenRequest);
return embedToken;
- MichaelWash4 years ago
Helper I
Are you using a Service Principal (or Master User and a Password)? If so, perhaps that could explain the difference? See: Accessing dataset requires effective identity use... - Microsoft Power BI Community
- JAnder4 years ago
Helper II
It is Service Principal.
- MichaelWash4 years ago
Helper I
I re-checked our code and yes, if a dataset is not using Row Level Security, it does not need an Effective Identity passed. However, we are *not* getting the error, you are getting, when we do pass an Effective Identity.