Ich versuche, die Elemente (und aktualisieren Sie sie in einem zweiten Schritt) aus einer Sharepoint Online-Liste in Powershell.Powershell get Listenelemente von Sharepoint online mit CSOM API
Ich habe mehrere Beispiele im Internet versucht, kann aber nicht herausfinden, was das Problem ist.
Wenn Sie den Code wie im folgenden Beispiel ausgeführt wird: How to get items from a sharepoint online list using PowerShell
$url ="https://company.sharepoint.com/sites/some/site/link"
$username="[email protected]"
$password="pw"
$Password = $password |ConvertTo-SecureString -AsPlainText -force
Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type –Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Function Get-ListItems([Microsoft.SharePoint.Client.ClientContext]$Context, [String]$ListTitle) {
$list = $Context.Web.Lists.GetByTitle($listTitle)
$qry = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()
$items = $list.GetItems($qry)
$Context.Load($items)
$Context.ExecuteQuery()
return $items
}
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$Context.Credentials = $credentials
$context.RequestTimeOut = 5000 * 60 * 10;
$web = $context.Web
$context.load($web)
$context.ExecuteQuery()
Get-ListItems -Context $context -ListTitle "myListTitle"
ich diesen Fehler immer erhalten:
format-default : The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
+ CategoryInfo : NotSpecified: (:) [format-default], CollectionNotInitializedException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.CollectionNotInitializedException,Microsoft.PowerShell.Commands.FormatDefaultCommand
Haben Sie eine Idee haben, was falsch sein könnte?
Vielen Dank im Voraus Duffkess