Setting PBI report policies with .Net OData client
In our company we have a lot of reports with a dozens of users, therefore we would like to automate the policy setting with a small .Net application in VS2019. First I configured a connected service with ,,OData Connected Service'' extension in the project. That works fine until a try to load the policies for a specific report, but in the last step a recieve an error message: ,,A property with name 'Id' was found when reading a top-level resource set. No properties other than the resource set property with name 'value' are allowed.''
Here is my code:
using Model; // this is the namespace of the automatically generated OData client
static void Main(string args)
var context = new Container(new Uri("https://my.company.com/Reports/api/v2.0"));
context.Credentials = System.Net.CredentialCache.DefaultCredentials;
PowerBIReport ci = context.PowerBIReports.Where(c => c.Path.Contains("SampleReport")).Single();
context.LoadProperty(ci, "Policies"); // ERROR
the last line throws the error. I also tried the ,,expand'' method but it is not working with the report servers API.
In my understanding the a LoadProperty command expects a json response like