Forum Discussion
JFM_12
Apr 03, 2020Iron Contributor
SharePoint on Prem - Update List
Hello I am running a Powershell to update a list. While running this powershell with my user account the columns are updated. While running this powershell through taks-scheduler (other user) th...
Sudharsan K
Apr 04, 2020Iron Contributor
Hi,
Try to use try-catch block within the PowerShell to capture for any issues. If there is no issue, then the fields are skipped because of the permission, make sure the scheduler run on-behalf of the user who has permission to update the fields.
Try to use try-catch block within the PowerShell to capture for any issues. If there is no issue, then the fields are skipped because of the permission, make sure the scheduler run on-behalf of the user who has permission to update the fields.
- JFM_12Apr 06, 2020Iron Contributor
Hello
Thank you for your input.I did already run try-catch and no errors
The task-Scheduler runs with an technical user with highest privileges.
The funny Thing user drops the data within the column but does not inserts the data.
Here the sample:
$items = $list.Items foreach($item in $items) { $owner = $item['Besitzer'] $ownertest = $owner -replace ".*#" $costcentercsv = $CSVData | Where-Object {$_.UsEMail -eq $ownertest} | % UsAccountNum $item[$costcenter] = $costcentercsv $item.Update(); } } Catch { $logger.LogError("Exception raised") $logger.LogException($_.Exception) $script:sitesErrors = $script:sitesErrors + 1 $script:scriptError = $true }Regards