public static void GenerateNewReportPageWithSaveAsRedirect(bool LaunchInBrowser = true)
        {
            // get Power BI embedding data
            var embeddingData = PbiEmbeddedManager.GetNewReportEmbeddingDataFirstParty();

            // parse embedding data into page template
            string htmlSource = Properties.Resources.EmbedNewReportWithSaveAsRedirect_html;
            string htmlOutput = htmlSource.Replace("@AppName", "Demo07: New 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 + "Demo07-EmbedNewReportWithSaveAsRedirect.html";

            File.WriteAllText(pagePath, htmlOutput);

            // launch page in browser if requested
            if (LaunchInBrowser)
            {
                LaunchPageInBrowser(pagePath);
            }
        }
Exemple #2
0
        public static void GenerateReportWithToolbarPage(bool LaunchInBrowser = true)
        {
            // get Power BI embedding data
            var embeddingData = PbiEmbeddedManager.GetReportEmbeddingData();

            // parse embedding data into page template
            string htmlSource = Properties.Resources.EmbedReportWithToolbar_html;
            string htmlOutput = htmlSource.Replace("@AppName", embeddingData.reportName)
                                .Replace("@EmbedReportId", embeddingData.reportId)
                                .Replace("@EmbedUrl", embeddingData.embedUrl)
                                .Replace("@EmbedToken", embeddingData.accessToken);


            // generate page file on local har drive
            string pageFileName = embeddingData.reportName.Replace(" ", "-");
            string pagePath     = rootFolder + pageFileName + ".html";

            File.WriteAllText(pagePath, htmlOutput);

            // launch page in browser if requested
            if (LaunchInBrowser)
            {
                LaunchPageInBrowser(pagePath);
            }
        }
        public static void GenerateDashboardTilePage(bool LaunchInBrowser = true)
        {
            // get Power BI embedding data
            var embeddingData = PbiEmbeddedManager.GetDashboardTileEmbeddingData();

            // parse embedding data into page template
            string htmlSource = Properties.Resources.EmbedDashboardTile_html;
            string htmlOutput = htmlSource.Replace("@AppName", "Demo05: 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 + "Demo05-EmbedDashboardTile.html";

            File.WriteAllText(pagePath, htmlOutput);

            // launch page in browser if requested
            if (LaunchInBrowser)
            {
                LaunchPageInBrowser(pagePath);
            }
        }
Exemple #4
0
        public static void GenerateReportWithRls(bool LaunchInBrowser = true)
        {
            // get Power BI embedding data
            var embeddingData = PbiEmbeddedManager.GetReportWithRlsEmbeddingData();

            // parse embedding data into page template
            string htmlSource = Properties.Resources.EmbedReportWithRLS_html;
            string htmlOutput = htmlSource.Replace("@AppName", "Demo18: RLS Embed Tokens")
                                .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 + "Demo18-ReportWithRLSEmbedTokens.html";

            File.WriteAllText(pagePath, htmlOutput);

            // launch page in browser if requested
            if (LaunchInBrowser)
            {
                LaunchPageInBrowser(pagePath);
            }
        }