<?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 Re: A working example of posting an RDL file wanted in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/1482917#M26400</link>
    <description>&lt;P&gt;Update: I returned to this issue and the import is working without error!&amp;nbsp; I'm using the C# POST.&amp;nbsp; Part of my issue was I'm POSTing an RDL and the only acceptable conflict" param values are "Abort" and "Overwrite", this isn't obvious in all instances of the docu, but it is there.&amp;nbsp; Passing something else returns a non-specific error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Aside: Unfortunately there's no good "Upsert" option, you have to know if the file exists in the destination directory before you make the call.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the OP C# example the problem might be the file isn't be passed in the proper format.&amp;nbsp; In my situation I'm GETting an RDL then POSTing it back.&amp;nbsp; I GET the file from azure source workspace into a string to manipulate it then POST it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The wrapper client call will package the file in the proper Form-Data structure for the Rest call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This C# works (GET then POST)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string localRdl

HttpOperationResponse&amp;lt;Stream&amp;gt; getResponse = await client.Reports.ExportReportInGroupWithHttpMessagesAsync([workspace Id], [report Id]);

if (getResponse.Response.StatusCode == HttpStatusCode.OK)
{
    var stream = getResponse.Response.Content.ReadAsStreamAsync();

    StreamReader reader = new StreamReader(stream.Result);
    localRdl = reader.ReadToEnd();
}

...
...

MemoryStream ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(localRdl));

HttpOperationResponse&amp;lt;Import&amp;gt; postResponse = await client.Imports.PostImportFileWithHttpMessage([Workspace ID], ms, [report name], "Abort");

if (postResponse.Response.StatusCode == HttpStatusCode.Accepted)
{
    /* all good */
}
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Nov 2020 14:31:46 GMT</pubDate>
    <dc:creator>fandrusi</dc:creator>
    <dc:date>2020-11-09T14:31:46Z</dc:date>
    <item>
      <title>A working example of posting an RDL file wanted</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/1155730#M24132</link>
      <description>&lt;P&gt;I am working on posting a paginated report file into a workspace by means of Power BI REST API -&lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/imports/postimportingroup" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/rest/api/power-bi/imports/postimportingroup&lt;/A&gt;. The workspace is associated wth an A4 capacity, so it supports paginated reports. Since I am working on an application for 3rd party customers, the emebed reports approach is applied. This entails that an access token is retrieved basing on a client ID/secret and it is used then for communication over with Power BI service by the REST API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While I am uploading a PBIX file no error is faced, however when I switch to a RDL file, I got this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"error":{"code":"RequestedFileIsEncryptedOrCorrupted","pbi.error":{"code":"RequestedFileIsEncryptedOrCorrupted","parameters":[],"details":[],"exceptionCulprit":1}}}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The URL, headers and body (I created an empty report for this test) look as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;https://api.powerbi.com/v1.0/myorg/groups/[removed]/imports?datasetDisplayName=Paginated&amp;amp;nameConflict=Abort&lt;BR /&gt;&lt;BR /&gt;Authorization: "Bearer [removed]"&lt;BR /&gt;Content-Type: "multipart/form-data; boundary=bbd44c43bfdb666aae510c2963f1f58a7df6f20172ee69c494ab549df1bf"&lt;BR /&gt;&lt;BR /&gt;--bbd44c43bfdb666aae510c2963f1f58a7df6f20172ee69c494ab549df1bf&lt;BR /&gt;Content-Disposition: form-data; name="file"; filename="blank.rdl"&lt;BR /&gt;Content-Type: application/rdl&lt;BR /&gt;&lt;BR /&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;BR /&gt;&amp;lt;Report MustUnderstand="df" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily"&amp;gt;&lt;BR /&gt;&amp;lt;rd:ReportUnitType&amp;gt;Mm&amp;lt;/rd:ReportUnitType&amp;gt;&lt;BR /&gt;&amp;lt;rd:ReportID&amp;gt;852f90cd-e634-4063-9524-ee42e4b14caf&amp;lt;/rd:ReportID&amp;gt;&lt;BR /&gt;&amp;lt;df:DefaultFontFamily&amp;gt;Segoe UI&amp;lt;/df:DefaultFontFamily&amp;gt;&lt;BR /&gt;&amp;lt;AutoRefresh&amp;gt;0&amp;lt;/AutoRefresh&amp;gt;&lt;BR /&gt;&amp;lt;ReportSections&amp;gt;&lt;BR /&gt;&amp;lt;ReportSection&amp;gt;&lt;BR /&gt;&amp;lt;Body&amp;gt;&lt;BR /&gt;&amp;lt;ReportItems&amp;gt;&lt;BR /&gt;&amp;lt;Textbox Name="ReportTitle"&amp;gt;&lt;BR /&gt;&amp;lt;rd:WatermarkTextbox&amp;gt;Title&amp;lt;/rd:WatermarkTextbox&amp;gt;&lt;BR /&gt;&amp;lt;rd:DefaultName&amp;gt;ReportTitle&amp;lt;/rd:DefaultName&amp;gt;&lt;BR /&gt;&amp;lt;CanGrow&amp;gt;true&amp;lt;/CanGrow&amp;gt;&lt;BR /&gt;&amp;lt;KeepTogether&amp;gt;true&amp;lt;/KeepTogether&amp;gt;&lt;BR /&gt;&amp;lt;Paragraphs&amp;gt;&lt;BR /&gt;&amp;lt;Paragraph&amp;gt;&lt;BR /&gt;&amp;lt;TextRuns&amp;gt;&lt;BR /&gt;&amp;lt;TextRun&amp;gt;&lt;BR /&gt;&amp;lt;Value /&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;&lt;BR /&gt;&amp;lt;FontFamily&amp;gt;Segoe UI Light&amp;lt;/FontFamily&amp;gt;&lt;BR /&gt;&amp;lt;FontSize&amp;gt;28pt&amp;lt;/FontSize&amp;gt;&lt;BR /&gt;&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/TextRun&amp;gt;&lt;BR /&gt;&amp;lt;/TextRuns&amp;gt;&lt;BR /&gt;&amp;lt;Style /&amp;gt;&lt;BR /&gt;&amp;lt;/Paragraph&amp;gt;&lt;BR /&gt;&amp;lt;/Paragraphs&amp;gt;&lt;BR /&gt;&amp;lt;Top&amp;gt;0mm&amp;lt;/Top&amp;gt;&lt;BR /&gt;&amp;lt;Height&amp;gt;12.7mm&amp;lt;/Height&amp;gt;&lt;BR /&gt;&amp;lt;Width&amp;gt;139.7mm&amp;lt;/Width&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;&lt;BR /&gt;&amp;lt;Border&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;None&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/Border&amp;gt;&lt;BR /&gt;&amp;lt;PaddingLeft&amp;gt;2pt&amp;lt;/PaddingLeft&amp;gt;&lt;BR /&gt;&amp;lt;PaddingRight&amp;gt;2pt&amp;lt;/PaddingRight&amp;gt;&lt;BR /&gt;&amp;lt;PaddingTop&amp;gt;2pt&amp;lt;/PaddingTop&amp;gt;&lt;BR /&gt;&amp;lt;PaddingBottom&amp;gt;2pt&amp;lt;/PaddingBottom&amp;gt;&lt;BR /&gt;&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/Textbox&amp;gt;&lt;BR /&gt;&amp;lt;/ReportItems&amp;gt;&lt;BR /&gt;&amp;lt;Height&amp;gt;57.15mm&amp;lt;/Height&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;&lt;BR /&gt;&amp;lt;Border&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;None&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/Border&amp;gt;&lt;BR /&gt;&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/Body&amp;gt;&lt;BR /&gt;&amp;lt;Width&amp;gt;152.4mm&amp;lt;/Width&amp;gt;&lt;BR /&gt;&amp;lt;Page&amp;gt;&lt;BR /&gt;&amp;lt;PageFooter&amp;gt;&lt;BR /&gt;&amp;lt;Height&amp;gt;11.43mm&amp;lt;/Height&amp;gt;&lt;BR /&gt;&amp;lt;PrintOnFirstPage&amp;gt;true&amp;lt;/PrintOnFirstPage&amp;gt;&lt;BR /&gt;&amp;lt;PrintOnLastPage&amp;gt;true&amp;lt;/PrintOnLastPage&amp;gt;&lt;BR /&gt;&amp;lt;ReportItems&amp;gt;&lt;BR /&gt;&amp;lt;Textbox Name="ExecutionTime"&amp;gt;&lt;BR /&gt;&amp;lt;rd:DefaultName&amp;gt;ExecutionTime&amp;lt;/rd:DefaultName&amp;gt;&lt;BR /&gt;&amp;lt;CanGrow&amp;gt;true&amp;lt;/CanGrow&amp;gt;&lt;BR /&gt;&amp;lt;KeepTogether&amp;gt;true&amp;lt;/KeepTogether&amp;gt;&lt;BR /&gt;&amp;lt;Paragraphs&amp;gt;&lt;BR /&gt;&amp;lt;Paragraph&amp;gt;&lt;BR /&gt;&amp;lt;TextRuns&amp;gt;&lt;BR /&gt;&amp;lt;TextRun&amp;gt;&lt;BR /&gt;&amp;lt;Value&amp;gt;=Globals!ExecutionTime&amp;lt;/Value&amp;gt;&lt;BR /&gt;&amp;lt;Style /&amp;gt;&lt;BR /&gt;&amp;lt;/TextRun&amp;gt;&lt;BR /&gt;&amp;lt;/TextRuns&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;&lt;BR /&gt;&amp;lt;TextAlign&amp;gt;Right&amp;lt;/TextAlign&amp;gt;&lt;BR /&gt;&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/Paragraph&amp;gt;&lt;BR /&gt;&amp;lt;/Paragraphs&amp;gt;&lt;BR /&gt;&amp;lt;Top&amp;gt;5.08mm&amp;lt;/Top&amp;gt;&lt;BR /&gt;&amp;lt;Left&amp;gt;101.6mm&amp;lt;/Left&amp;gt;&lt;BR /&gt;&amp;lt;Height&amp;gt;6.35mm&amp;lt;/Height&amp;gt;&lt;BR /&gt;&amp;lt;Width&amp;gt;50.8mm&amp;lt;/Width&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;&lt;BR /&gt;&amp;lt;Border&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;None&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/Border&amp;gt;&lt;BR /&gt;&amp;lt;PaddingLeft&amp;gt;2pt&amp;lt;/PaddingLeft&amp;gt;&lt;BR /&gt;&amp;lt;PaddingRight&amp;gt;2pt&amp;lt;/PaddingRight&amp;gt;&lt;BR /&gt;&amp;lt;PaddingTop&amp;gt;2pt&amp;lt;/PaddingTop&amp;gt;&lt;BR /&gt;&amp;lt;PaddingBottom&amp;gt;2pt&amp;lt;/PaddingBottom&amp;gt;&lt;BR /&gt;&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/Textbox&amp;gt;&lt;BR /&gt;&amp;lt;/ReportItems&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;&lt;BR /&gt;&amp;lt;Border&amp;gt;&lt;BR /&gt;&amp;lt;Style&amp;gt;None&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/Border&amp;gt;&lt;BR /&gt;&amp;lt;/Style&amp;gt;&lt;BR /&gt;&amp;lt;/PageFooter&amp;gt;&lt;BR /&gt;&amp;lt;PageHeight&amp;gt;29.7cm&amp;lt;/PageHeight&amp;gt;&lt;BR /&gt;&amp;lt;PageWidth&amp;gt;21cm&amp;lt;/PageWidth&amp;gt;&lt;BR /&gt;&amp;lt;LeftMargin&amp;gt;2cm&amp;lt;/LeftMargin&amp;gt;&lt;BR /&gt;&amp;lt;RightMargin&amp;gt;2cm&amp;lt;/RightMargin&amp;gt;&lt;BR /&gt;&amp;lt;TopMargin&amp;gt;2cm&amp;lt;/TopMargin&amp;gt;&lt;BR /&gt;&amp;lt;BottomMargin&amp;gt;2cm&amp;lt;/BottomMargin&amp;gt;&lt;BR /&gt;&amp;lt;ColumnSpacing&amp;gt;0.13cm&amp;lt;/ColumnSpacing&amp;gt;&lt;BR /&gt;&amp;lt;Style /&amp;gt;&lt;BR /&gt;&amp;lt;/Page&amp;gt;&lt;BR /&gt;&amp;lt;/ReportSection&amp;gt;&lt;BR /&gt;&amp;lt;/ReportSections&amp;gt;&lt;BR /&gt;&amp;lt;ReportParametersLayout&amp;gt;&lt;BR /&gt;&amp;lt;GridLayoutDefinition&amp;gt;&lt;BR /&gt;&amp;lt;NumberOfColumns&amp;gt;4&amp;lt;/NumberOfColumns&amp;gt;&lt;BR /&gt;&amp;lt;NumberOfRows&amp;gt;2&amp;lt;/NumberOfRows&amp;gt;&lt;BR /&gt;&amp;lt;/GridLayoutDefinition&amp;gt;&lt;BR /&gt;&amp;lt;/ReportParametersLayout&amp;gt;&lt;BR /&gt;&amp;lt;/Report&amp;gt;&lt;BR /&gt;--bbd44c43bfdb666aae510c2963f1f58a7df6f20172ee69c494ab549df1bf--&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have a working dump of of HTTP headers and body enabling to upload an RDL file successfuly into the Power BI serivce? I am coding this stuff in GO, hence the HTTP level fits me best.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried to use a PowerShell approach which I have found in Internet resources:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; Publish-PowerBIImport {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;param &lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; [&lt;/SPAN&gt;&lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt;]$Path,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; [&lt;/SPAN&gt;&lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt;]$GroupId&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;$powerBiBodyTemplate = &lt;/SPAN&gt;&lt;SPAN&gt;@'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;--{0}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Content-Disposition: form-data; name="file"; filename="{1}"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Content-Type: application/rdl&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;{2}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;--{0}--&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'@&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; $fileName = [&lt;/SPAN&gt;&lt;SPAN&gt;IO.Path&lt;/SPAN&gt;&lt;SPAN&gt;]::GetFileName($Path)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; $boundary = [&lt;/SPAN&gt;&lt;SPAN&gt;guid&lt;/SPAN&gt;&lt;SPAN&gt;]::NewGuid().ToString()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; $fileBytes = [&lt;/SPAN&gt;&lt;SPAN&gt;System.IO.File&lt;/SPAN&gt;&lt;SPAN&gt;]::ReadAllBytes($Path)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; $encoding = [&lt;/SPAN&gt;&lt;SPAN&gt;System.Text.Encoding&lt;/SPAN&gt;&lt;SPAN&gt;]::GetEncoding(&lt;/SPAN&gt;&lt;SPAN&gt;"utf-8"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; $filebody = $encoding.GetString($fileBytes)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; $body = $powerBiBodyTemplate &lt;/SPAN&gt;&lt;SPAN&gt;-f&lt;/SPAN&gt;&lt;SPAN&gt; $boundary, $fileName, $encoding.GetString($fileBytes)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; $headers = &lt;/SPAN&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;   "Authorization"&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Bearer [removed]"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;  $url = &lt;/SPAN&gt;&lt;SPAN&gt;"https://api.powerbi.com/v1.0/myorg/groups/$GroupId/imports?datasetDisplayName=$fileName&amp;amp;nameConflict=Abort"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $body -ContentType &lt;/SPAN&gt;&lt;SPAN&gt;"multipart/form-data; boundary=--$boundary"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;$groupId = &lt;/SPAN&gt;&lt;SPAN&gt;"[removed]"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;$id = Publish-PowerBIImport -GroupId $groupId -Path &lt;/SPAN&gt;&lt;SPAN&gt;"./file.rdl"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;It work better, as the content seems to be processed. To confirm that I stopped the capacity for a while:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;Invoke-RestMethod : {"error":{"code":"PaginatedReportCapacityStoppedOrNotFound","pbi.error":{"code":"PaginatedReportCapacityStoppedOrNotFound","parameters":{},"details":[{"code":"capacityObjectId","detail":{"type":1,"value":"[removed]"}}],"exceptionCulprit":1}}}&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, after restarting it, I got another UnknownError:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Invoke-RestMethod : {"error":{"code":"UnknownError","pbi.error":{"code":"UnknownError","parameters":{},"details":[],"exceptionCulprit":1}}}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps this means that the file data sent by the GO program is malformed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also given a try to C#:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; System;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; System.Collections.Generic;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; System.Linq;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; System.Threading.Tasks;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//Install-Package Microsoft.PowerBI.Api&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; Microsoft.PowerBI.Api;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; Microsoft.PowerBI.Api.Models;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; System.IO;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; System.Threading;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;using&lt;/SPAN&gt;&lt;SPAN&gt; Microsoft.Rest;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;namespace&lt;/SPAN&gt;&lt;SPAN&gt; importPbix_PBIE&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;  class&lt;/SPAN&gt;&lt;SPAN&gt; Program&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;  {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    static&lt;/SPAN&gt; &lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt; workspaceCollectionName = &lt;/SPAN&gt;&lt;SPAN&gt;"Paginated"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    static&lt;/SPAN&gt; &lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt; workspaceId = &lt;/SPAN&gt;&lt;SPAN&gt;"[removed]"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    static&lt;/SPAN&gt; &lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt; filePath = &lt;/SPAN&gt;&lt;SPAN&gt;@"./blank.rdl"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    static&lt;/SPAN&gt; &lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt; accessToken = &lt;/SPAN&gt;&lt;SPAN&gt;"[removed]"&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    static&lt;/SPAN&gt; &lt;SPAN&gt;void&lt;/SPAN&gt;&lt;SPAN&gt; Main(&lt;/SPAN&gt;&lt;SPAN&gt;string&lt;/SPAN&gt;&lt;SPAN&gt;[] args)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;      var&lt;/SPAN&gt;&lt;SPAN&gt; credentials = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;TokenCredentials&lt;/SPAN&gt;&lt;SPAN&gt;(accessToken, &lt;/SPAN&gt;&lt;SPAN&gt;"Bearer"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;      var&lt;/SPAN&gt;&lt;SPAN&gt; client = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;PowerBIClient&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Uri&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$"{"https://api.powerbi.com"}"&lt;/SPAN&gt;&lt;SPAN&gt;), credentials);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;      using&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; file = File.Open(filePath, FileMode.Open))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;     {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;       try&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;         var&lt;/SPAN&gt;&lt;SPAN&gt; import = client.Imports.PostImportWithFileInGroup(&lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Guid&lt;/SPAN&gt;&lt;SPAN&gt;(workspaceId), file, workspaceCollectionName, &lt;/SPAN&gt;&lt;SPAN&gt;"Abort"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;         Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN&gt;"{0}"&lt;/SPAN&gt;&lt;SPAN&gt;, import);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;       }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;       catch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Microsoft&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Rest&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;HttpOperationException&lt;/SPAN&gt;&lt;SPAN&gt; e) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;         Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN&gt;"{0} {1}"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;           e.Response.Content,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;           e.Response.StatusCode);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;         }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;         while&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;) ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;       }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;     }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;   }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unfortunatelly, the result is the same as in case of the 1st program in GO:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{"error":{"code":"RequestedFileIsEncryptedOrCorrupted","pbi.error":{"code":"RequestedFileIsEncryptedOrCorrupted","parameters":{},"details":[],"exceptionCulprit":1}}} BadRequest&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A working HTTP flow or any ideas would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Michal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 13:09:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/1155730#M24132</guid>
      <dc:creator>micpol</dc:creator>
      <dc:date>2020-06-12T13:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: A working example of posting an RDL file wanted</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/1326984#M25463</link>
      <description>&lt;P&gt;Having the identical problem.&amp;nbsp; &amp;nbsp;It's odd that there's a PowerBI client which makes it very easy to pull down .RDLs but submitting them feels nearly impossible.&amp;nbsp; I figure there must be a wrapper for the content prep somplace, otherwise it's pretty difficult to deal with.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 21:16:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/1326984#M25463</guid>
      <dc:creator>fandrusi</dc:creator>
      <dc:date>2020-08-26T21:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: A working example of posting an RDL file wanted</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/1482917#M26400</link>
      <description>&lt;P&gt;Update: I returned to this issue and the import is working without error!&amp;nbsp; I'm using the C# POST.&amp;nbsp; Part of my issue was I'm POSTing an RDL and the only acceptable conflict" param values are "Abort" and "Overwrite", this isn't obvious in all instances of the docu, but it is there.&amp;nbsp; Passing something else returns a non-specific error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Aside: Unfortunately there's no good "Upsert" option, you have to know if the file exists in the destination directory before you make the call.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the OP C# example the problem might be the file isn't be passed in the proper format.&amp;nbsp; In my situation I'm GETting an RDL then POSTing it back.&amp;nbsp; I GET the file from azure source workspace into a string to manipulate it then POST it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The wrapper client call will package the file in the proper Form-Data structure for the Rest call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This C# works (GET then POST)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;string localRdl

HttpOperationResponse&amp;lt;Stream&amp;gt; getResponse = await client.Reports.ExportReportInGroupWithHttpMessagesAsync([workspace Id], [report Id]);

if (getResponse.Response.StatusCode == HttpStatusCode.OK)
{
    var stream = getResponse.Response.Content.ReadAsStreamAsync();

    StreamReader reader = new StreamReader(stream.Result);
    localRdl = reader.ReadToEnd();
}

...
...

MemoryStream ms = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(localRdl));

HttpOperationResponse&amp;lt;Import&amp;gt; postResponse = await client.Imports.PostImportFileWithHttpMessage([Workspace ID], ms, [report name], "Abort");

if (postResponse.Response.StatusCode == HttpStatusCode.Accepted)
{
    /* all good */
}
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 14:31:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/1482917#M26400</guid>
      <dc:creator>fandrusi</dc:creator>
      <dc:date>2020-11-09T14:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: A working example of posting an RDL file wanted</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/4820241#M63038</link>
      <description>&lt;P&gt;Any update on this issue ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Having the identical problem.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2025 14:48:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/4820241#M63038</guid>
      <dc:creator>mmouton</dc:creator>
      <dc:date>2025-09-08T14:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: A working example of posting an RDL file wanted</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/4824383#M63093</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I tryed your code exporting then importing and I still have a 'BadRequest' with same error in header.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X-PowerBI-Error-Details: {"error":{"code":"RequestedFileIsEncryptedOrCorrupted","pbi.error":{"code":"RequestedFileIsEncryptedOrCorrupted","parameters":[],"details":[],"exceptionCulprit":1}}}&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2025 09:39:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/A-working-example-of-posting-an-RDL-file-wanted/m-p/4824383#M63093</guid>
      <dc:creator>mmouton</dc:creator>
      <dc:date>2025-09-12T09:39:29Z</dc:date>
    </item>
  </channel>
</rss>

