Forum Discussion

gjwesteneng's avatar
gjwesteneng
New Member
9 years ago
Solved

Delete report, or dataset

My problem is that I want to be able to delete a report based on its ID. I've seen that it's possible to delete a dataset, which will subsequently delete the related reports. But when I have a repo...
  • gjwesteneng's avatar
    gjwesteneng
    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.