<?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 {Operation returned an invalid status code 'Forbidden} while executing ExportToFileInGroupAsync in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Operation-returned-an-invalid-status-code-Forbidden-while/m-p/1194137#M24470</link>
    <description>&lt;P&gt;I am trying to export a power BI report in my custom application.&lt;/P&gt;&lt;P&gt;I added a button, and on that button click, i am executing this code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var url = XXX;&lt;BR /&gt;var content = new Dictionary&amp;lt;string, string&amp;gt;();&lt;BR /&gt;content["grant_type"] = "XXX";&lt;BR /&gt;content["resource"] = "XXX";&lt;BR /&gt;content["username"] = XXX;&lt;BR /&gt;content["password"] = XXX;&lt;BR /&gt;content["client_id"] = XXX;&lt;/P&gt;&lt;P&gt;var response = await APIHelper.MakeAsyncRequest(url, content);&lt;BR /&gt;var tokenresult = response.Content.ReadAsStringAsync().Result;&lt;BR /&gt;var OAuthResultModel = JsonConvert.DeserializeObject&amp;lt;OAuthResultModel&amp;gt;(tokenresult);&lt;BR /&gt;var authenticationResult = OAuthResultModel;&lt;/P&gt;&lt;P&gt;var credentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");&lt;BR /&gt;var client = new PowerBIClient(credentials);&lt;BR /&gt;var reportsResult = await client.Reports.ExportToFileInGroupAsync(GroupID, ReportID, exportRequest);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when code execute the last line , the error occured.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saadashraf_0-1593587074025.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/303227i1AFF47897682C203/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saadashraf_0-1593587074025.png" alt="saadashraf_0-1593587074025.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jul 2020 07:06:09 GMT</pubDate>
    <dc:creator>saadashraf</dc:creator>
    <dc:date>2020-07-01T07:06:09Z</dc:date>
    <item>
      <title>{Operation returned an invalid status code 'Forbidden} while executing ExportToFileInGroupAsync</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Operation-returned-an-invalid-status-code-Forbidden-while/m-p/1194137#M24470</link>
      <description>&lt;P&gt;I am trying to export a power BI report in my custom application.&lt;/P&gt;&lt;P&gt;I added a button, and on that button click, i am executing this code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var url = XXX;&lt;BR /&gt;var content = new Dictionary&amp;lt;string, string&amp;gt;();&lt;BR /&gt;content["grant_type"] = "XXX";&lt;BR /&gt;content["resource"] = "XXX";&lt;BR /&gt;content["username"] = XXX;&lt;BR /&gt;content["password"] = XXX;&lt;BR /&gt;content["client_id"] = XXX;&lt;/P&gt;&lt;P&gt;var response = await APIHelper.MakeAsyncRequest(url, content);&lt;BR /&gt;var tokenresult = response.Content.ReadAsStringAsync().Result;&lt;BR /&gt;var OAuthResultModel = JsonConvert.DeserializeObject&amp;lt;OAuthResultModel&amp;gt;(tokenresult);&lt;BR /&gt;var authenticationResult = OAuthResultModel;&lt;/P&gt;&lt;P&gt;var credentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");&lt;BR /&gt;var client = new PowerBIClient(credentials);&lt;BR /&gt;var reportsResult = await client.Reports.ExportToFileInGroupAsync(GroupID, ReportID, exportRequest);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when code execute the last line , the error occured.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saadashraf_0-1593587074025.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/303227i1AFF47897682C203/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saadashraf_0-1593587074025.png" alt="saadashraf_0-1593587074025.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 07:06:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Operation-returned-an-invalid-status-code-Forbidden-while/m-p/1194137#M24470</guid>
      <dc:creator>saadashraf</dc:creator>
      <dc:date>2020-07-01T07:06:09Z</dc:date>
    </item>
  </channel>
</rss>

