Forum Discussion
send2prasan
8 years agoHelper I
Power BI API Integration with C#
Dear All, We are having a multi-tenant C# application. We are storing all the database name in session. I have downloaded the sample application by following the link for Power BI dashboard e...
Eric_Zhang
8 years agoMicrosoft Employee
I see you're getting the dataset from a group, so when set the connection string, use SetAllDatasetConnectionsInGroup instead.
Also, to get more specific information, please add a try..catch block to capture the response details message.
try
{
//client.Datasets.PostRowsInGroup(groupId, "dcb49dcc-7392-4277-9258-ec26bd842b42", "RealTimeData", dataObj);
ConnectionDetails cn = new ConnectionDetails();
cn.ConnectionString = "data source=Computer1\\SQLEXPRESS;initial catalog=Db_Tent1;persist security info=True;User Id=Username;Password=Password;encrypt=True;trustservercertificate=False";
//var datsetList = client.Datasets.GetDatasources(GroupId);
var datasets = client.Datasets.GetDatasetsInGroup(groupId);
var dashboards1 = client.Datasets.SetAllDatasetConnectionsInGroup(groupId,datasets.Value[0].Id, cn);
}
catch (HttpOperationException ex)
{
//Bad Request
var content = ex.Response.Content;
Console.WriteLine(content);
}Anonymous
8 years agoNot applicable
I am getting the following exception :
Operation returned an invalid status code 'BadRequest'