Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

PostRows not working with package Microsoft.PowerBi.Api

I was able to get the rest APIs working quickly in C#. The code works fine without any errors or exceptions, but the PostRows ( ) method didn't seem to work.   The dataset, table, and columns get c...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Further investigation revealed that the sdk doesn't handle serialization of anonymous types and silently blanks them out.

    As an example, this can be overcome/verified by specifying serialization settings as below.

     

    PowerBiClient.SerializationSettings.ContractResolver = new DefaultContractResolver(); //anonymous types serialize to blank {} without this
                await PowerBiClient.Datasets.PostRowsAsync(dataset.Id, tableName, postRows);

     

    The sdk doesn't have great documentation - almost none actually.