Open ikarstein opened 4 years ago
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
This works:
$item = Get-PnpListItem -List "abc" -Id 1
$list = Get-PnpList -Identity "abc"
$item3 = $list.GetItemByUniqueId($item["UniqueId"])
(Get-PnPContext).Load($item3)
Invoke-PnPQuery
write-host $item3.Id # => 1
I tried with CAML taken from
Commands/Lists/GetListItem.cs
Same result.
BUT when I change the FieldRef
from "GUID" (as it is in the source currently) to "UniqueId" I get the result.
Not working:
Get-PnPListItem -List "abc" -Query "<View><Query><Where><Eq><FieldRef Name='GUID'/><Value Type='Guid'>2875f838-8c6f-4de1-9655-72f37f5c345d</Value></Eq></Where></Query></View>"
Working:
Get-PnPListItem -List "abc" -Query "<View><Query><Where><Eq><FieldRef Name='UniqueId'/><Value Type='Guid'>2875f838-8c6f-4de1-9655-72f37f5c345d</Value></Eq></Where></Query></View>"
Looks like a bug in source.
Here is a hint to the "BuiltInFieldName":
As mentioned in the PR you have filed for this one, even though it feels illogical, this is by design. You should instead use the value from the Guid field:
$item = Get-PnpListItem -List "abc" -Id 1
$item2 = Get-PnpListItem -List "abc" -UniqueId ($item["Guid"])
Then it should work.
Reporting an Issue or Missing Feature
Issue
Expected behavior
Get List Item from SPO with UniqueID using cmdlet
Get-PnpListItem -List "abc" -UniqueId "2875f838-8c6f-4de1-9655-72f37f5c345d"
Actual behavior
cmdlet returns $null
Steps to reproduce behavior
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
3.14.1910.1
How did you install the PnP-PowerShell Cmdlets?