pnp/PnP

Set-PnPListItem 

elazar-b opened this issue · 2 comments

####Which PnP repository should you use to report the issue?####
PnP PowerShell - https://github.com/OfficeDev/PnP-PowerShell

Category

[ X] Bug
[ ] Enhancement

Environment

[X ] Office 365 / SharePoint Online
[ ] SharePoint 2016
[ ] SharePoint 2013

If SharePoint on-premises, what's exact CU version:

Expected or Desired Behavior

Set-PnPListItem -List "test" -Identity $ConnectToSPs.Id -Values @{"Status" = "Failed" }
When requesting status change on page SharePoint

Observed Behavior

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.

Steps to Reproduce

Connect-PnPOnline -Url ........

$ConnectToSPs = Get-PnPListItem -List "test" | Where-Object { ($_)["Status"] -eq "Waiting" }
set-mailbox ......etc

Set-PnPListItem -List "test" -Identity $ConnectToSPs.Id -Values @{"Status" = "Failed" }

error :
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.

Hi @elazar-b, this is a more PowerShell issue. Just catch the cmdlet result in a variable like $item = Set-PnPlistItem. Maybe this article could help.

Thanks a lot - the solution helped