Forum Discussion
Running paginated report from c#
I know how to run SSRS reports from c# using HttpClient. It is basically like this:
var uri = new Uri("report url");
var credentialsCache = new CredentialCache();
credentialsCache.Add(uri, "NTLM", new NetworkCredential("username", "password"));
var handler = new HttpClientHandler() { Credentials = credentialsCache, PreAuthenticate = true };
using (var client = new HttpClient(handler))
{
var response = client.PostAsync(uri, httpContent).Result;
...
}Can a paginated report be run in a similar fashion? Please note, I am using PostAsync to send a large number of parameters to the report. Also, what about credentials?
Thanks
4 Replies
- MikeJohnsonZA
Responsive Resident
Hi, yes this is possible.
you can use the Power BI REST API's to make a call to the service to render the paginated report in the format of your choice. the call you are looking for the ExportTo endpoint.
you can read more about this here Export Power BI embedded analytics paginated reports API - Power BI | Microsoft Docs
- Markzolotoy
Impactful Individual
Before I dive into the provided links let me ask you this. So, I have to use APis, right? I cannot run it as I run SSRS report - using report's url?
- MikeJohnsonZA
Responsive Resident
I don't believe so as the security model and rendering engine are different.
The API approach is pretty easy and if you are just looking to extract the report you can look at the Power BI Powershell cmdlets which make the API's really easy to use Power BI Cmdlets reference | Microsoft Docs.
- Markzolotoy
Impactful Individual
Am I looking at the correct link?
MicrosoftPowerBIMgmt.Reports Module | Microsoft Docs
I am not sure it is about paginated reports.