Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
hson89
New Member

Dataset.Tables is always null in Power BI for .NET v2

Hi everyone,

 

I'm trying to get the access to the tables inside a dataset. I managed to get access to the dataset however the when I use dataset.Tables it always returns null. I also tried to use Datasets.GetTables and passed my dataset ID however it returned "Operation returned an invalid status code 'NotFound'" while with the same Dataset ID, I can get the dataset successfully. I'm using Microsoft.PowerBI.Api.V2 and developing on a Windows App. Can someone help to point out what I am missing here please? Below is my code

 

var credential = new UserPasswordCredential(Username, Password);

// Authenticate using created credentials
var authenticationContext = new AuthenticationContext(AuthorityUrl);
var authenticationResult = authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential).Result;

var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

// Create a Power BI Client object (it will be used to call Power BI APIs)
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
{
	var dataset = client.Datasets.GetDatasetByIdAsync("My dataset id");
}

 

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@hson89 wrote:

Hi everyone,

 

I'm trying to get the access to the tables inside a dataset. I managed to get access to the dataset however the when I use dataset.Tables it always returns null. I also tried to use Datasets.GetTables and passed my dataset ID however it returned "Operation returned an invalid status code 'NotFound'" while with the same Dataset ID, I can get the dataset successfully. I'm using Microsoft.PowerBI.Api.V2 and developing on a Windows App. Can someone help to point out what I am missing here please? Below is my code

 

var credential = new UserPasswordCredential(Username, Password);

// Authenticate using created credentials
var authenticationContext = new AuthenticationContext(AuthorityUrl);
var authenticationResult = authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential).Result;

var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

// Create a Power BI Client object (it will be used to call Power BI APIs)
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
{
	var dataset = client.Datasets.GetDatasetByIdAsync("My dataset id");
}

 


@hson89

What type is the dataset? The underlying REST API Get Tables only supports  push datasets and hybrid datasets(streaming dataset with historic data analysis enabled).

Capture.PNG

 

View solution in original post

5 REPLIES 5
Eric_Zhang
Microsoft Employee
Microsoft Employee


@hson89 wrote:

Hi everyone,

 

I'm trying to get the access to the tables inside a dataset. I managed to get access to the dataset however the when I use dataset.Tables it always returns null. I also tried to use Datasets.GetTables and passed my dataset ID however it returned "Operation returned an invalid status code 'NotFound'" while with the same Dataset ID, I can get the dataset successfully. I'm using Microsoft.PowerBI.Api.V2 and developing on a Windows App. Can someone help to point out what I am missing here please? Below is my code

 

var credential = new UserPasswordCredential(Username, Password);

// Authenticate using created credentials
var authenticationContext = new AuthenticationContext(AuthorityUrl);
var authenticationResult = authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential).Result;

var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

// Create a Power BI Client object (it will be used to call Power BI APIs)
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
{
	var dataset = client.Datasets.GetDatasetByIdAsync("My dataset id");
}

 


@hson89

What type is the dataset? The underlying REST API Get Tables only supports  push datasets and hybrid datasets(streaming dataset with historic data analysis enabled).

Capture.PNG

 

Hello.

Where is this screen on the powerBI platform? I am new on this service and I don't know where is the option to change this.

Hi,

 

You can find it under the left menu > Workspaces>Datasets

Hi, cool! I found it.

 

But how can I change a dataset api access type? Is there a war to do that?

Thank you @Eric_Zhang. It wasn't a Push dataset or Hybrid. Thanks for your advice.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.