Closed paoIpao closed 2 years ago
@paololec - Don't delete the template provided when opening an issue. Please fill the below so we can have a look at it.
Also, if you get an error, run Get-PnPException
just after and paste it in the "Actual Behavior" section.
Please confirm what it is that your reporting
Please describe what output you expect to see from the PnP PowerShell Cmdlets
Please describe what you see instead. Please provide samples of output or screenshots.
Please include complete script or code samples in-line
(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable
)
Invoke-PnpBatch language problem. No exception but wrong number format (on site with default: italian). NumberCol is 100.945 and not 1.009,45 (seems that the expected input must be in locale language when using batch). If I execute only Add-PnPListItem WITHOUT BATCH NumberCol is correct 1.009,45 and the input $RowValues1 expected is english format (so also date in format MM/dd/yyyy and number in format 1009.45 ).
Other problem (only with batch) when using multiple value in multi choice (example: "Choice 1", "Choice 2") I have other error : (Message : Un nodo di tipo 'StartArray' è stato letto dal lettore JSON durante il tentativo di lettura di un valore di una proprietà, ma era previsto il nodo 'PrimitiveValue' o 'StartObject'. Stacktrace : at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in c:\PnPPowerShell\src\Commands\Base\PnPSharePointCmdlet.cs:line 70 at System.Management.Automation.CommandProcessor.ProcessRecord() ScriptLineNumber : 21 )
NumberCol on sharepoint site is: 1.009,45
NumberCol on sharepoint site (default language is italian) is: 100.945
$site = "https://tenant.sharepoint.com/sites/testSite" Connect-PnPOnline -Url $site
$list = Get-PnPList -Identity "TestList1" $batch = New-PnPBatch $RowValues1 = @{ "CurrencyCol" = "10.50"; "MultipleTextCol" = "Text text text text"; "CalculatedValueCol" = "11"; "PeopleCol" = "UserTest"; "YesNoCol" = "True"; "Title" = "Test1"; "DateCol" = "30/03/2021 00:00:00"; "NumberCol" = "1009.45"; "HyperlinkCol" = "https://www.microsoft.com"; "ChoiceCol" = "Choice 2"; "PeopleMultipleCol" = "user@mycompany.com"; "SingleLineTextCol" = "Test"; "MultipleChoiceCol" = "Choice 1"; "DateTime" = "31/03/2021 14:00:00"; } Add-PnPListItem -List $list -Values $RowValues1 -Batch $batch Invoke-PnPBatch $batch -StopOnException
1.6.0
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days
Looking into this one.
I can reproduce the behavior. Trying to think what would make most sense here to do. Please next time report one issue per issue report.
Summarizing:
So no batch: always US format, with batch: format of the site
Both cases send the values as provided to the SharePoint backend, so its the backend deviating here. We can't just fix it from the code side as doing so would not be backwards compatible. Probably have to go with documenting this behavior and leaving it as is.
Updated documentation on second issue as well. When using a multiple choice column field, you must use this syntax:
-Values @{ChoiceColumnName="Choice 1;#Choice 2;#Choice 3"}
So separate multiple options using ;#
Closing this issue as it should be resolved with the updated documentation in the above PR. Feel free to reopen if it doesn't work for you yet.
When execute Invoke-PnPBatch after add-pnplistitem I have some problem with the language for number value, it's seems that I need use local language and pass number with comma for decimal, while if I execute only add-pnplistitem without batch I need pass number in english format with dot and not comma for decimal.