Forum Discussion
Delete report, or dataset
- 9 years ago
I found a possible solution in using the ID of the import class that was used when uploading:
// Import PBIX file from the file str Import import = client.Imports.PostImportWithFile(_workspaceCollectionName, _workspaceId, file, datasetName);
This gives me an import.Id which I can store (instead of storing the report id like I do now).
When looking up the report I can lookup the import and find the report:
Import import = client.Imports.GetImportById(_workspaceCollectionName, _workspaceId, importId); import.Reports[0].Id;
We deleting a report I can find the corresponding dataset:
Import import = client.Imports.GetImportById(_workspaceCollectionName, _workspaceId, importId); import.Datasets[0].Id;
It looks like the imports are persited, at least for a couple of months, so I assume this should be ok.
I don't find any API to get datasetId using reportId.
The thing I've noticed is that a dataset name are the same as a report name, so it might be one approach to get datasetId using reportName.
You can retrive the reports' names and IDs via
client.Reports.GetReportsAsync(_workspaceCollectionName, _workspaceId)
You can retrive the datasets' names and IDs via below snappet in the Case '8' in ProvisionSample.
await ListDatasets(workspaceCollectionName, workspaceId);
Save both above to database tables and Join them on the column datasetName and reportName.
By the way, you will have to use an extra parameter "Overwrite" to avoid duplicated dataset/report names when importing a pbix.
var import = await client.Imports.PostImportWithFileAsync
(workspaceCollectionName, workspaceId, fileStream, datasetName, "Overwrite");
Thanks for your suggestion!!
Unfortunately the dataset/report names are not unique, it's allowed to upload reports with the same name.
How can it be that there's no way to get a report's dataset or to get a dataset's reports??
- gjwesteneng9 years agoNew Member
I found a possible solution in using the ID of the import class that was used when uploading:
// Import PBIX file from the file str Import import = client.Imports.PostImportWithFile(_workspaceCollectionName, _workspaceId, file, datasetName);
This gives me an import.Id which I can store (instead of storing the report id like I do now).
When looking up the report I can lookup the import and find the report:
Import import = client.Imports.GetImportById(_workspaceCollectionName, _workspaceId, importId); import.Reports[0].Id;
We deleting a report I can find the corresponding dataset:
Import import = client.Imports.GetImportById(_workspaceCollectionName, _workspaceId, importId); import.Datasets[0].Id;
It looks like the imports are persited, at least for a couple of months, so I assume this should be ok.