Forum Discussion
A working example of posting an RDL file wanted
Update: I returned to this issue and the import is working without error! I'm using the C# POST. 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. Passing something else returns a non-specific error.
(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.)
In the OP C# example the problem might be the file isn't be passed in the proper format. In my situation I'm GETting an RDL then POSTing it back. I GET the file from azure source workspace into a string to manipulate it then POST it.
The wrapper client call will package the file in the proper Form-Data structure for the Rest call.
This C# works (GET then POST)
string localRdl
HttpOperationResponse<Stream> 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<Import> postResponse = await client.Imports.PostImportFileWithHttpMessage([Workspace ID], ms, [report name], "Abort");
if (postResponse.Response.StatusCode == HttpStatusCode.Accepted)
{
/* all good */
}
- mmouton11 months agoFrequent Visitor
Hello,
I tryed your code exporting then importing and I still have a 'BadRequest' with same error in header.
X-PowerBI-Error-Details: {"error":{"code":"RequestedFileIsEncryptedOrCorrupted","pbi.error":{"code":"RequestedFileIsEncryptedOrCorrupted","parameters":[],"details":[],"exceptionCulprit":1}}}