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.
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應