Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Content not available on PowerBi Embed

I'm not a coder, so this could be a silly question...   I've read al the steps to be taken to get an EmbedURL, EmbedID and token. I've found a samplescript to embed the report which I've used, but ...
  • Eric_Zhang's avatar
    9 years ago

    Anonymous wrote:

    I'm not a coder, so this could be a silly question...

     

    I've read al the steps to be taken to get an EmbedURL, EmbedID and token. I've found a samplescript to embed the report which I've used, but I'm getting the message "Content is not available".

    PowerBi is started and loading (the logo is visable), but the report is not showing up.

     

    On the testsite on github it works (https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html).

     

    the code I'm using is a singlepage tester:

    <html>
    
    <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>
    
    <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
    
    <script type="text/javascript">
    window.onload = function () {  
     
    
     var embedConfiguration = {
        type: 'report',
        accessToken: 'H4sIAAAAAAAEACWVxQ7t--------bla----ThignOLIUBiiF4JPYp9H_IP5__4fXjzlxZoKAAA=',    
    	id: '0eb3674a-xxxx-xxxx-xxxx-xxxx1fb6b17d',
        embedUrl: 'https://app.powerbi.com/reportEmbed?reportId=0eb36741461fb6b17d&groupId=1928fd4564' 
    	
    }; 
     
    
    var $reportContainer = $('#reportContainer');
     
    var report = powerbi.embed($reportContainer.get(0), embedConfiguration); 
    
    <!--validateReportLoad incorrectly returns schema errors for valid filters #16https://github.com/Microsoft/powerbi-models/issues/16-->
    
    report.on('loaded', function() {
    console.log('report.on - loaded');
    });
    
    }
    </script>
    
    <div id="reportContainer" powerbi-settings-nav-content-pane-enabled="true"   powerbi-settings-filter-pane-enabled="true"></div>
    
    </html>

     

    Has any got an idea what I've done wrong? permissions, public in stead of private, etc...

    Thanks for all the help you can provide

     

    Jordy


    Anonymous

    See below sample, it shall work. Note that the embedded token is dedicated for the reportid, see GenerateToken. Since you're not a coder, I'm curious how you got the embedded token and what you'd like to do with this static HTML. As I can recall, the sample in your post shall be from one of my previous posts, which is supposed for testing purpose. The static HTML is very limited as the token can be expired and needs to be updated dynamically in a programming way.

    <html>
    
    <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>
    <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
    
    <script type="text/javascript">
    window.onload = function () {
     // Read embed application token from Model
        var accessToken = "H4sIAAAAAAxxxxxxxxxxxxxxxxmA-to_mf_3fwvmOUYCCwAA";
    
        // Read embed URL from Model
        var embedUrl = "https://app.powerbi.com/reportEmbed?reportId=bd851208-5592-4e3e-ba72-5cfdfc39f41c&groupId=9166cf8d-d5fc-405e-bdc7-47e414da08fe";
    
        // Read dashboard Id from Model
        var embedReportId = "bd851208-5592-4e3e-ba72-5cfdfc39f41c";
    
        // Get models. models contains enums that can be used.
        var models = window['powerbi-client'].models;
     
        var config = {
            type: 'report',
            tokenType: models.TokenType.Embed,
            accessToken: accessToken,
            embedUrl: embedUrl, 
            viewMode: models.ViewMode.View,
            id: embedReportId,	
    		 
        };
    	
    	console.log(models);
    
        // Get a reference to the embedded dashboard HTML element
        var reportContainer = $('#reportContainer')[0] ;
    
        // Embed the dashboard and display it within the div container.
        var report = powerbi.embed(reportContainer, config); 
     
    } 
    </script> 
     
    <div id="reportContainer"></div>
    
    </html>