powershell - PowerShell 错误:新对象:找不到“PlatformParameters”的重载和参数计数:“1”
问题描述
我正在尝试使用 Git 存储库 PowerBIPS 将 CSV 自动上传到 PowerBi。我似乎无法克服这个错误:
新对象:找不到“PlatformParameters”和参数计数的重载:“1”。
借助此处链接的文章(https://powerbi.microsoft.com/en-us/blog/using-a-power-bi-app-to-upload-csv-files-to-a-dataset/) ,我相信我已经找到了一个可行的解决方案来解决这个问题。但是,我遇到了一个我似乎无法弄清楚的错误。
我已经定制了原始文章中的代码以适应我目前的情况(在下面的代码中概述)。我可以一直运行代码,直到出现此错误的“将数据发送到 PowerBi 注释”。
我曾尝试参考 Git 文档来帮助解决此问题,但没有找到运气。我感觉它与连接到 PowerBi 的身份验证部分有关。
while ($true) {
# Iterate each CSV file and send to PowerBI
Get-ChildItem "$currentPath\CSVData" -Filter "*.csv" | % {
$file = $_
#Import csv and add column with filename
$data = Import-Csv $file.FullName |
select @{Label="File";Expression={$file.Name}}, *
# Send data to PowerBI
$data | Out-PowerBI -DataSetName "CSVSales" -TableName "Sales" -Types @{
"Sales.OrderDate" = "datetime";
"Sales.SalesAmount" = "double";
"Sales.Freight" = "double"
} -BatchSize 300 -Verbose
# Archive the file
Move-Item $file.FullName "$currentPath\CSVData\Archive\" -Force
}
Write-Output "Sleeping..."
Sleep -Seconds 5
}
详细:获取身份验证令牌 VERBOSE:使用默认身份验证流程 新对象:找不到“PlatformParameters”和参数的重载 计数:“1”。 在 C:\Program Files\WindowsPowerShell\Modules\PowerBIPS\2.0.3.1\PowerBIPS.psm1:299 char:16 + ... pltParams = 新对象 Microsoft.IdentityModel.Clients.ActiveDirector ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [New-Object], MethodException + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
解决方案
推荐阅读
- java - Spring Boot WebFlux 不适用于 Azure 功能
- android - 如何在 Android 中像 Facebook 微光效果一样为渐变颜色设置动画
- java - Packed Jar 文件中不存在数据库文件
- php - 我可以将 CodeIgniter 4 与 PHP 7.2 一起使用吗?
- python - Python连续“打开”没有写第二个文件打开
- python - 如何将 txt 文件转换为 CSV 文件?
- java - Hibernate/JPA 继承类更改
- python-3.x - 如何使用 WebSocket 发送消息?
- appium - 如何在 centos 8 上运行 Appium 服务器后台?
- flutter - 在 null 上调用了 getter 'address'。蓝牙连接到设备 flutter_bluetooth_serial