Forum Discussion
toy
Advocate I
7 years agoSAVE AS in embedded power bi - callback for in-app power bi button
hi everyone right now in an embedded report - there are 2 ways to SAVE AS 1. thru the JS lib report.saveAs() 2. thru allowing SaveAs and Edit perms on a report and thereby allowing the user to use...
- Anonymous7 years ago
Could this be what you are looking for?
// report.on will add an event handler .
report.on("saved", function(event) {
alert('saved');
}
Anonymous
7 years agoNot applicable
Ted, that's great. Just added this and it's working except for one thing. When the app redirects to the new report it's not getting the rls attached to it, which matches the old report. If I log out of our embedded app and then log back in it's there. Any thoughts on why that could be?
TedPattison
Microsoft Employee
7 years agoIf you are using third-party embedding (app-owns-data), you must generate an embed token with the RLS roles(s) you want to enforce embedded inside. Try using something like this to generate the embed token using the EffectiveIdentity class.
public static NewReportEmbeddingData GetNewReportWithRlsEmbeddingData() {
string embedUrl = "https://app.powerbi.com/reportEmbed?groupId=" + workspaceId;
PowerBIClient pbiClient = GetPowerBiClient();
GenerateTokenRequest generateTokenRequestParameters =
new GenerateTokenRequest(accessLevel: "create",
datasetId: datasetId,
identities: new List<EffectiveIdentity> {
new EffectiveIdentity(username: "[email protected]",
datasets: new List<string> { datasetId },
roles: new List<string> { "Your RLS Role" }));
string embedToken = pbiClient.Reports.GenerateTokenForCreateInGroup(workspaceId,
generateTokenRequestParameters).Token;
return new NewReportEmbeddingData {
workspaceId = workspaceId,
datasetId = datasetId,
embedUrl = embedUrl,
accessToken = embedToken
};
}