Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Clampazzo
Helper I
Helper I

is it normal for when I run Embedded export to pdf it resets embedded report

I am setting up an apps own data embedded export to pdf using ExportToFileInGroup and then polling to see if the file is available and of course download the file. 

 

However, I noticed when stepping through the code when I run the above steps (it doesn't appear to be consistent but always happens between the above 2) my embedded report resets.  What I mean by that is I navigate to the embedded report, select the one I want, hit Export to PDF and then the report goes away to default from when i arrive at our site.  Sometimes it exports and sometimes it doesn't.  


I can't seem to find any error messages when it does this.  I've turned on try and catch but no error messages.  

 

 

     var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
     {

         Identities = new List<EffectiveIdentity>
         {
             new EffectiveIdentity
             {
                 Username = userName.ToString(),
                 Roles =new List<string> { "RLS" },
                 Datasets = new List<string> { DATSETID }
             }
 },
         Settings = new ExportReportSettings
         {
             Locale = "en-us"
           
         },
 


     };

     var exportRequest = new ExportReportRequest
     {
         Format = format,
         PowerBIReportConfiguration = powerBIReportExportConfiguration
     };
     if (ExportFilter != "")
     {
         exportRequest.PowerBIReportConfiguration.ReportLevelFilters =
           new List<ExportFilter>() {
     new ExportFilter { Filter = ExportFilter }
           };
     }
     

     try
     {
      
         var export =  client.Reports.ExportToFileInGroup(groupId, reportId, exportRequest);

         string exportId = export.Id.ToString();

 

1 ACCEPTED SOLUTION

Resolved it... the issue was in the javascript code that called the c# code.  I removed this at the end:  location.reload();.  

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Clampazzo ,

Can you please share some more detail information about this issue? They should help us clarify your scenario and test to troubleshoot.

How to Get Your Question Answered Quickly  

In addition, any reload/refresh events are you triggered? They may reset the stored variables and effect the export function usages.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Let me know if this helps.  
I load my report in embedded so it can be seen IE below

Clampazzo_0-1711631244640.png

Then I click on my new "Export to PDF" Button which executes the code above.  When it gets to the step(s) 

ExportToFileInGroup

or

GetExportToFileStatusInGroup

 

the embedded report 'resets' and basically goes back to what it looks like before I select a report.

Clampazzo_1-1711631443309.png

 

The export works but if I wanted to continue working int hat report I'd have to load it again.

 

 

Resolved it... the issue was in the javascript code that called the c# code.  I removed this at the end:  location.reload();.  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.