hi, do you use this script against Sharepoint Online or on-prem? How exactly do you import Sharepoint CSOM into PowerShell?
Try to check what exact type $itemSP variable has:
Write-Host $itemSP.GetType().FullName
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello I'm facing strange issue, my script is working perfectly on my local laptop but when I try to execute it from Azure function I'm getting an exception.
Goal of this script is to update SharePoint item from external API. When I assigned a value to my sharepoint item metadata with this code :
$itemSP[$mapping.SP]=$value
I'm getting this exception on every metatada assignement (of any type) :
Cannot convert value "Title" to type "System.Int32". Error: "Input string was not in a correct format." at Update-Items, <No file>: line 94 at run.ps1: line 180 + + + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : InvalidCastFromStringToInteger,run.ps1
There is any reason ?
Thanks for your assist.
hi, do you use this script against Sharepoint Online or on-prem? How exactly do you import Sharepoint CSOM into PowerShell?
Try to check what exact type $itemSP variable has:
Write-Host $itemSP.GetType().FullName
Looking into the error message it says that value "Title" cannot be converted to System.Int32 i.e. looks like the value is expected as an integer value.
Can you please verify what code you have written/executing in line no 94 in the run.ps1 file and verify if you are passing the integer value or not for that statement.
If the expected value is a string then you need to update your code on line 94. If the value can be empty that in your code you need to first verify where the value is null or empty before typecasting it.