Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Option #7 gives an error #20

Closed
julianmbs opened this issue Aug 15, 2016 · 4 comments
Closed

Option #7 gives an error #20

julianmbs opened this issue Aug 15, 2016 · 4 comments
Labels

Comments

@julianmbs
Copy link

Hi,

When I try to update data source credentials (option #7), I get an error "Index was out of range. Must be non-negative and less than the size of the collection". When I debug it, I see that line 544 (client.Datasets.GetGatewayDatasourcesAsync) returns NULL to datasources variable, even though all the parameters are set correctly (workspaceCollectionName, workspaceId, and datasetKey). What could be the problem?

Thanks,
Julia

@wbreza
Copy link
Contributor

wbreza commented Aug 16, 2016

Is your dataset a DirectQuery dataset? Updating credentials is only supported on a direct query datasets.

@julianmbs
Copy link
Author

Some of my datasets are DirectQuery and some are not, I would like to update the ones that are. Looks like the code takes the ID of the last dataset?

datasets.Value[datasets.Value.Count - 1].Id

Is that the problem?

@julianmbs
Copy link
Author

I changed the code to make sure it takes the ID of the dataset that is DirectQuery for sure, but I am still getting NULL:

var datasources = await client.Datasets.GetGatewayDatasourcesAsync(workspaceCollectionName, workspaceId, datasets.Value[0].Id);

Any other ideas?

@wbreza
Copy link
Contributor

wbreza commented Aug 16, 2016

Yes - you are correct. This sample only illustrates updating the last dataset. Feel free to augment to fit your needs.

We also have a more feature rich cross platform CLI tool that has better support than this sample. Check it out @ https://github.com/Microsoft/PowerBI-Cli.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants