// demo 30 public static void GenerateReportWithDynamicBinding(bool LaunchInBrowser = true) { // get Power BI embedding data var embeddingData = PowerBiApiServiceManager.GetReportEmbeddingDataDynamicBinding(); // parse embedding data into page template string htmlSource = Properties.Resources.EmbedReportWithDynamicBinding_html; string htmlOutput = htmlSource.Replace("@AppName", "Demo30: Dynamic Binding") .Replace("@EmbedReportId", embeddingData.reportId) .Replace("@EmbedUrl", embeddingData.embedUrl) .Replace("@EmbedToken", embeddingData.embedToken) .Replace("@DatasetId", embeddingData.dataset1Id) .Replace("@Dataset2Id", embeddingData.dataset2Id) .Replace("@Dataset3Id", embeddingData.dataset3Id); // generate page file on local har drive string pagePath = rootFolder + "Demo30-EmbedReport-DynamicBinding.html"; File.WriteAllText(pagePath, htmlOutput); // launch page in browser if requested if (LaunchInBrowser) { LaunchPageInBrowser(pagePath); } }
// demo 28 public static void GenerateReportWithRls(bool LaunchInBrowser = true) { // get Power BI embedding data var embeddingData = PowerBiApiServiceManager.GetReportWithRlsEmbeddingData(); // parse embedding data into page template string htmlSource = Properties.Resources.EmbedReportWithRLS_html; string htmlOutput = htmlSource.Replace("@AppName", "Demo28: Row Level Security") .Replace("@EmbedReportId", embeddingData.reportId) .Replace("@EmbedUrl", embeddingData.embedUrl) .Replace("@EmbedTokenAllData", embeddingData.embedTokenAllData) .Replace("@EmbedTokenWesternSales", embeddingData.embedTokenWesternSales) .Replace("@EmbedTokenCentralSales", embeddingData.embedTokenCentralSales) .Replace("@EmbedTokenEasternSales", embeddingData.embedTokenEasternSales) .Replace("@EmbedTokenCombo", embeddingData.embedTokenCombo); // generate page file on local har drive string pagePath = rootFolder + "Demo28-EmbedReport-RowLevelSecurity.html"; File.WriteAllText(pagePath, htmlOutput); // launch page in browser if requested if (LaunchInBrowser) { LaunchPageInBrowser(pagePath); } }
// demo 02 public static void GenerateReportPageAppOwnsData(bool LaunchInBrowser = true) { // get Power BI embedding data var embeddingData = PowerBiApiServiceManager.GetReportEmbeddingData(); // parse embedding data into page template string htmlSource = Properties.Resources.EmbedReport_html; string htmlOutput = htmlSource.Replace("@AppName", "Demo02: Embed Report - App-Owns-Data") .Replace("@EmbedReportId", embeddingData.reportId) .Replace("@EmbedUrl", embeddingData.embedUrl) .Replace("@EmbedToken", embeddingData.accessToken) .Replace("EmbedTokenType", "models.TokenType.Embed"); // generate page file on local har drive string pagePath = rootFolder + "Demo02-EmbedReport-AppOwnsData.html"; File.WriteAllText(pagePath, htmlOutput); // launch page in browser if requested if (LaunchInBrowser) { LaunchPageInBrowser(pagePath); } }
// demo 09 public static void GenerateNewReportPageWithSaveAsRedirect(bool LaunchInBrowser = true) { // get Power BI embedding data var embeddingData = PowerBiApiServiceManager.GetNewReportEmbeddingDataUserOwnsData(); // parse embedding data into page template string htmlSource = Properties.Resources.EmbedNewReportWithSaveAsRedirect_html; string htmlOutput = htmlSource.Replace("@AppName", "Demo08: New Report with SaveAs") .Replace("@EmbedWorkspaceId", embeddingData.workspaceId) .Replace("@EmbedDatasetId", embeddingData.datasetId) .Replace("@EmbedUrl", embeddingData.embedUrl) .Replace("@EmbedToken", embeddingData.accessToken); // generate page file on local har drive string pagePath = rootFolder + "Demo09-EmbedNewReport-WithSaveAsRedirect.html"; File.WriteAllText(pagePath, htmlOutput); // launch page in browser if requested if (LaunchInBrowser) { LaunchPageInBrowser(pagePath); } }
// demo 04 public static void GenerateDashboardTilePage(bool LaunchInBrowser = true) { // get Power BI embedding data var embeddingData = PowerBiApiServiceManager.GetDashboardTileEmbeddingData(); // parse embedding data into page template string htmlSource = Properties.Resources.EmbedDashboardTile_html; string htmlOutput = htmlSource.Replace("@AppName", "Demo04: Dashboard Tile") .Replace("@EmbedDashboardId", embeddingData.dashboardId) .Replace("@EmbedTileId", embeddingData.TileId) .Replace("@EmbedUrl", embeddingData.embedUrl) .Replace("@EmbedToken", embeddingData.accessToken); // generate page file on local har drive string pagePath = rootFolder + "Demo04-EmbedDashboardTile.html"; File.WriteAllText(pagePath, htmlOutput); // launch page in browser if requested if (LaunchInBrowser) { LaunchPageInBrowser(pagePath); } }
// demo 31 public static void GenerateNewReportCreateVisual(bool LaunchInBrowser = true) { // get Power BI embedding data var embeddingData = PowerBiApiServiceManager.GetReportEmbeddingData(); // parse embedding data into page template string htmlSource = Properties.Resources.EmbedNewReportCreateVisuals_html; string htmlOutput = htmlSource.Replace("@AppName", "Demo31: Create Visuals") .Replace("@EmbedReportId", embeddingData.reportId) .Replace("@EmbedUrl", embeddingData.embedUrl) .Replace("@EmbedToken", embeddingData.accessToken); // generate page file on local har drive string pagePath = rootFolder + "Demo31-EmbedNewReport-CreateVisual.html"; File.WriteAllText(pagePath, htmlOutput); // launch page in browser if requested if (LaunchInBrowser) { LaunchPageInBrowser(pagePath); } }
// demo 29 public static void GenerateReportWithCorrelationId(bool LaunchInBrowser = true) { // get Power BI embedding data var embeddingData = PowerBiApiServiceManager.GetReportWithAuditingData(); // parse embedding data into page template string htmlSource = Properties.Resources.EmbedReportWithCorrelationId_html; string htmlOutput = htmlSource.Replace("@AppName", "Demo29: Correlation ID") .Replace("@EmbedReportId", embeddingData.reportId) .Replace("@EmbedUrl", embeddingData.embedUrl) .Replace("@EmbedToken", embeddingData.embedToken) .Replace("@UserName", embeddingData.userName); // generate page file on local har drive string pagePath = rootFolder + "Demo29-EmbedReport-CorrelationId.html"; File.WriteAllText(pagePath, htmlOutput); // launch page in browser if requested if (LaunchInBrowser) { LaunchPageInBrowser(pagePath); } }