Forum Discussion
This content isn't available after calling powered.embed($container, config)
- Anonymous9 years ago
Thank you for your response. I was able to get this figured out this mornig. It seems I was just missing a few properties of the config that you pass to the powerbi.embed function. Now my config looks like.....
self.embedConfig = {type: 'report',accessToken: config.EmbedToken.token,tokenType: pbi.models.TokenType.Embed,id: config.Id,embedUrl: config.EmbedUrl,permissions: pbi.models.Permissions.All,settings: {filterPaneEnabled: true,navContentPaneEnabled: true}}WIth the above properties set, the reports started showing up just fine. Thanks for all your help.Stizz001
Anonymous
Well, I don't see Embed token mentioned in your post, so guess that you may embed with the access token? The Embed token is generated specifically for individual reports/dashboards/tile with the accesstoken(See GenerateToken). You can get the GenerateToken by calling the REST API or with Power BI API.
var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");
// Create a Power BI Client object. It will be used to call Power BI APIs.
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
{
// Get a list of reports.
var reports = await client.Reports.GetReportsInGroupAsync(GroupId);
// Get the first report in the group.
var report = reports.Value.FirstOrDefault();
if (report == null)
{
return View(new EmbedConfig()
{
ErrorMessage = "Group has no reports."
});
}
// Generate Embed Token.
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(GroupId, report.Id, generateTokenRequestParameters);
if (tokenResponse == null)
{
return View(new EmbedConfig()
{
ErrorMessage = "Failed to generate embed token."
});
}
// Generate Embed Configuration.
var embedConfig = new EmbedConfig()
{
EmbedToken = tokenResponse,
EmbedUrl = report.EmbedUrl,
Id = report.Id
};
return View(embedConfig);
}
The embed token is a string starting with "H4sIAAAAAAAEA ....". A static html demo attached for your reference.
- Anonymous9 years agoNot applicable
Thank you for your response. I was able to get this figured out this mornig. It seems I was just missing a few properties of the config that you pass to the powerbi.embed function. Now my config looks like.....
self.embedConfig = {type: 'report',accessToken: config.EmbedToken.token,tokenType: pbi.models.TokenType.Embed,id: config.Id,embedUrl: config.EmbedUrl,permissions: pbi.models.Permissions.All,settings: {filterPaneEnabled: true,navContentPaneEnabled: true}}WIth the above properties set, the reports started showing up just fine. Thanks for all your help.Stizz001