<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Power BI Report Server - PBIX report export  programmatically in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-Report-Server-PBIX-report-export-programmatically/m-p/2676283#M25112</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have installed Power BI Report Server in VM and have serveral report file with .PBIX exension file. I want to export PBIX report in excel format using C# program. I have tried Microsoft API for power BI and it is working with Power BI app (app.powerbi.com).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we use Microsoft Power BI API 2.0 for Power BI Report Server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nimit&lt;/P&gt;</description>
    <pubDate>Tue, 02 Aug 2022 17:29:40 GMT</pubDate>
    <dc:creator>nimit</dc:creator>
    <dc:date>2022-08-02T17:29:40Z</dc:date>
    <item>
      <title>Power BI Report Server - PBIX report export  programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-Report-Server-PBIX-report-export-programmatically/m-p/2676283#M25112</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have installed Power BI Report Server in VM and have serveral report file with .PBIX exension file. I want to export PBIX report in excel format using C# program. I have tried Microsoft API for power BI and it is working with Power BI app (app.powerbi.com).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we use Microsoft Power BI API 2.0 for Power BI Report Server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nimit&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 17:29:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-Report-Server-PBIX-report-export-programmatically/m-p/2676283#M25112</guid>
      <dc:creator>nimit</dc:creator>
      <dc:date>2022-08-02T17:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Report Server - PBIX report export  programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-Report-Server-PBIX-report-export-programmatically/m-p/2683335#M25150</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="420551" data-lia-user-login="nimit" class="lia-mention lia-mention-user"&gt;nimit&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to import the relevant program interface first, and then provide some methods to export the relevant report as follows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;links:&lt;A href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.powerbi.api.v2.ireports?view=azure-dotnet" target="_blank"&gt;IReports Interface (Microsoft.PowerBI.Api.V2) - Azure for .NET Developers | Microsoft Docs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition you can also refer to the following blog to give relevant information, I hope it will help you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.c-sharpcorner.com/blogs/powerbi-report-server-rest-api" target="_blank"&gt;Accessing REST API In PowerBI Report Server (c-sharpcorner.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Henry&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 06:09:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-Report-Server-PBIX-report-export-programmatically/m-p/2683335#M25150</guid>
      <dc:creator>v-henryk-mstf</dc:creator>
      <dc:date>2022-08-05T06:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Report Server - PBIX report export  programmatically</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-Report-Server-PBIX-report-export-programmatically/m-p/2684591#M25164</link>
      <description>&lt;P&gt;Hi Henery,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your kind response.&lt;/P&gt;&lt;P&gt;Here I my code which will help you for more support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Power bi report server URL -&amp;nbsp;"&lt;A href="https://powerbireport.server.com/" target="_blank" rel="noopener"&gt;https://powerbireport.server.com/&lt;/A&gt;" - using this url I can access power bi report in browser&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Power BI Report - report ID (itemID field in catalog table of db) -&amp;nbsp;xxxxxxx-1111-22222-B8A7-6DD7D668ADA8&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;client.Reports.ExportToFile(reportId, exportRequest); - line of code throws an error&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;Microsoft.Rest.HttpOperationException: 'Operation returned an invalid status code 'NotFound''&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please confirm above two items are used correctly and how to resolve this error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var credentials = new TokenCredentials(TokenManager.GetAppOnlyAccessToken(), "Bearer");&lt;BR /&gt;using (var client = new PowerBIClient(new Uri("&lt;A href="https://powerbireport.server.com/" target="_blank" rel="noopener"&gt;https://powerbireport.server.com/&lt;/A&gt;"), credentials))&lt;BR /&gt;{&lt;BR /&gt;var exportRequest = new ExportReportRequest&lt;BR /&gt;{&lt;BR /&gt;Format = FileFormat.PDF,&lt;BR /&gt;PowerBIReportConfiguration = new PowerBIReportExportConfiguration&lt;BR /&gt;{&lt;BR /&gt;Settings = new ExportReportSettings&lt;BR /&gt;{&lt;BR /&gt;IncludeHiddenPages = false&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var reportId = new Guid("xxxxxxx-1111-22222-B8A7-6DD7D668ADA8");&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;var export = client.Reports.ExportToFile(reportId, exportRequest);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;string exportId = export.Id;&lt;BR /&gt;do&lt;BR /&gt;{&lt;BR /&gt;System.Threading.Thread.Sleep(10000);&lt;BR /&gt;export = client .Reports.GetExportToFileStatus(reportId, exportId);&lt;BR /&gt;Console.WriteLine(" - Export status: " + export.PercentComplete.ToString() + "% complete");&lt;BR /&gt;} while (export.Status != ExportState.Succeeded &amp;amp;&amp;amp; export.Status != ExportState.Failed);&lt;/P&gt;&lt;P&gt;if (export.Status == ExportState.Failed)&lt;BR /&gt;{&lt;BR /&gt;Console.WriteLine("Export failed!");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (export.Status == ExportState.Succeeded)&lt;BR /&gt;{&lt;BR /&gt;string FileName = "test.pdf";&lt;/P&gt;&lt;P&gt;string FilePath = "C:\\PowerBiReport\\" + FileName;&lt;/P&gt;&lt;P&gt;Console.WriteLine(" - Saving exported file to " + FilePath);&lt;BR /&gt;var exportStream = client .Reports.GetFileOfExportToFile(reportId, exportId);&lt;BR /&gt;FileStream fileStream = File.Create(FilePath);&lt;BR /&gt;exportStream.CopyTo(fileStream);&lt;BR /&gt;fileStream.Close();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Console.WriteLine();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 16:08:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-Report-Server-PBIX-report-export-programmatically/m-p/2684591#M25164</guid>
      <dc:creator>nimit</dc:creator>
      <dc:date>2022-08-05T16:08:20Z</dc:date>
    </item>
  </channel>
</rss>

