Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Check the UniqueId column instead of GUID column #68

Merged
merged 4 commits into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions documentation/Get-PnPListItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Retrieves the list item with ID 1 from the Tasks list
Get-PnPListItem -List Tasks -UniqueId bd6c5b3b-d960-4ee7-a02c-85dc6cd78cc3
```

Retrieves the list item with unique id bd6c5b3b-d960-4ee7-a02c-85dc6cd78cc3 from the tasks lists
Retrieves the list item with UniqueId or GUID bd6c5b3b-d960-4ee7-a02c-85dc6cd78cc3 from the tasks lists

### EXAMPLE 4
```powershell
Expand Down Expand Up @@ -222,7 +222,7 @@ Accept wildcard characters: False
```

### -UniqueId
The unique id (GUID) of the item to retrieve
The UniqueId or GUID of the item to retrieve

```yaml
Type: Guid
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Lists/GetListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected override void ExecuteCmdlet()
}
viewFieldsStringBuilder.Append("</ViewFields>");
}
query.ViewXml = $"<View><Query><Where><Eq><FieldRef Name='GUID'/><Value Type='Guid'>{UniqueId}</Value></Eq></Where></Query>{viewFieldsStringBuilder}</View>";
query.ViewXml = $"<View><Query><Where><Or><Eq><FieldRef Name='GUID'/><Value Type='Guid'>{UniqueId}</Value></Eq><Eq><FieldRef Name='UniqueId' /><Value Type='Guid'>{UniqueId}</Value></Eq></Or></Where></Query>{viewFieldsStringBuilder}</View>";
var listItem = list.GetItems(query);
ClientContext.Load(listItem);
ClientContext.ExecuteQueryRetry();
Expand Down