Power BI Embedded libraries for .NET
Power BI is a cloud-based business analytics service that gives you a single view of your most critical business data.
To learn more about using Power BI with .NET, see Embedding with Power BI.
Client library
Use the client library to connect with Power BI APIs to access and interact with data sets and reports.
Install the NuGet package directly from the Visual Studio Package Manager console.
Visual Studio Package Manager
Install-Package Microsoft.PowerBI.Api
Example
The following example retrieves and displays a list of datasets and reports.
/* Include these'using' directive:
using Microsoft.PowerBI.Api.V2;
using Microsoft.PowerBI.Api.V2.Models;
*/
using (PowerBIClient client = new PowerBIClient(new Uri(apiUrl), tokenCredentials))
{
Console.WriteLine("\r*** DATASETS ***\r");
// List of datasets in a group/app workspace
ODataResponseListDataset datasetList = client.Datasets.GetDatasetsInGroup(groupId);
foreach(Dataset ds in datasetList.Value)
{
Console.WriteLine(ds.Id + " | " + ds.Name);
}
Console.WriteLine("\r*** REPORTS ***\r");
// List of reports in a group/app workspace
ODataResponseListReport reportList = client.Reports.GetReportsInGroup(groupId);
foreach (Report rpt in reportList.Value)
{
Console.WriteLine(rpt.Id + " | " + rpt.Name + " | DatasetID = " + rpt.DatasetId);
}
}
Samples
Explore more sample .NET code you can use in your apps.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Azure SDK for .NET
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for