-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Using version 1.0.487.
If say, I publish a report, clone the report in the same workspace and then republish the original report:
$FilePath = "example.pbix"
$WorkspaceId = "..."
$report = New-PowerBIReport -Path $FilePath -WorkspaceId $WorkspaceId -ConflictAction CreateOrOverwrite
Copy-PowerBIReport -WorkspaceId $WorkspaceId -Id $report.Id -Name "example 2"
New-PowerBIReport -Path $FilePath -WorkspaceId $WorkspaceId -ConflictAction CreateOrOverwrite
I get an error from the second publish
Exception : System.InvalidOperationException: Sequence contains more than one element at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) at Microsoft.PowerBI.Common.Api.Reports.ReportsClient.PostReportForWorkspace(Guid workspaceId, String reportName, String filePath, ImportConflictHandlerModeEnum nameConflict, Int32 timeout) at Microsoft.PowerBI.Commands.Reports.NewPowerBIReport.ExecuteCmdlet() at Microsoft.PowerBI.Commands.Common.PowerBICmdlet.ProcessRecord() InnerException : False Message : Sequence contains more than one element StackTrace : at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) at Microsoft.PowerBI.Common.Api.Reports.ReportsClient.PostReportForWorkspace(Guid workspaceId, String reportName, String filePath, ImportConflictHandlerModeEnum nameConflict, Int32 timeout) at Microsoft.PowerBI.Commands.Reports.NewPowerBIReport.ExecuteCmdlet() at Microsoft.PowerBI.Commands.Common.PowerBICmdlet.ProcessRecord() HelpLink : Source : System.Linq ErrorDetails : ErrorCategory : WriteError: (Microsoft.PowerBI.C\u2026ts.NewPowerBIReport:NewPowerBIReport) [New-PowerBIReport], InvalidOperationException InvocationInfo : System.Management.Automation.InvocationInfo
Presumably from the return import.Reports.Single();
at the end of PostReportForWorkspace
because there are now 2 reports in the collection
public Report PostReportForWorkspace(Guid workspaceId, string reportName, string filePath, ImportConflictHandlerModeEnum nameConflict, int timeout)
{
var importId = this.PostImportForWorkspace(workspaceId, reportName, filePath, nameConflict);
Nullable<DateTime> timeoutAt = null;
if (timeout > 0)
{
timeoutAt = DateTime.Now.AddSeconds(timeout);
}
Import import = null;
do
{
import = this.GetImportForWorkspace(workspaceId: workspaceId, importId: importId);
if (import.ImportState != "Succeeded")
{
if (timeoutAt != null && DateTime.Now > timeoutAt)
{
throw new TimeoutException();
}
else
{
System.Threading.Thread.Sleep(500);
}
}
} while (import.ImportState == "Publishing");
if (import.ImportState != "Succeeded")
{
throw new ImportException(importId, reportName, import.ImportState);
}
return import.Reports.Single();
}
agolaszewski and KalnoSenelis
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working