diff --git a/CHANGELOG.md b/CHANGELOG.md index 41650dff9..deb0c62a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Added - Added `-MediaTranscription` and `-MediaTranscriptionAutomaticFeatures` to `Set-PnPTenant` which allows for configuring the media transcription settings. [#3238](https://github.com/pnp/powershell/pull/3238) -- Added `AllowCommentsTextOnEmailEnabled` parameter to `Set-PnPTenant` which allows including the surrounding document context in email notification when user is mentioned in document comments. [#3268](https://github.com/pnp/powershell/pull/3268) +- Added `-Includes` option to `Get-PnPListItem` which allows for specifying additional fields to be retrieved. [#3270](https://github.com/pnp/powershell/pull/3270) +- Added `-AllowCommentsTextOnEmailEnabled` parameter to `Set-PnPTenant` which allows including the surrounding document context in email notification when user is mentioned in document comments. [#3268](https://github.com/pnp/powershell/pull/3268) - Added `Export-PnPPowerApp` cmdlet which will export a specified PowerApp as zip package. [#2990](https://github.com/pnp/powershell/pull/2990) -- Added `AzureADLoginEndPoint` and `MicrosoftGraphEndPoint` parameters to `Connect-PnPOnline` cmdlet for use in custom Azure environments. [#2925](https://github.com/pnp/powershell/pull/2925) +- Added `-AzureADLoginEndPoint` and `-MicrosoftGraphEndPoint` parameters to `Connect-PnPOnline` cmdlet for use in custom Azure environments. [#2925](https://github.com/pnp/powershell/pull/2925) ### Fixed diff --git a/src/Commands/Lists/GetListItem.cs b/src/Commands/Lists/GetListItem.cs index 0ef020f5f..b17da8df8 100644 --- a/src/Commands/Lists/GetListItem.cs +++ b/src/Commands/Lists/GetListItem.cs @@ -11,7 +11,7 @@ namespace PnP.PowerShell.Commands.Lists { [Cmdlet(VerbsCommon.Get, "PnPListItem", DefaultParameterSetName = ParameterSet_ALLITEMS)] [OutputType(typeof(ListItem))] - public class GetListItem : PnPWebCmdlet + public class GetListItem : PnPWebRetrievalsCmdlet { private const string ParameterSet_BYID = "By Id"; private const string ParameterSet_BYUNIQUEID = "By Unique Id"; @@ -76,6 +76,8 @@ protected override void ExecuteCmdlet() { ClientContext.Load(listItem, l => l.ContentType, l => l.ContentType.Name, l => l.ContentType.Id, l => l.ContentType.StringId, l => l.ContentType.Description); } + if (RetrievalExpressions.Length > 0) + ClientContext.Load(listItem, RetrievalExpressions); ClientContext.ExecuteQueryRetry(); WriteObject(listItem); } @@ -95,7 +97,9 @@ protected override void ExecuteCmdlet() query.ViewXml = $"{UniqueId}{UniqueId}{viewFieldsStringBuilder}"; var listItem = list.GetItems(query); + // Call ClientContext.Load() with and without retrievalExpressions to load FieldValues, otherwise no fields will be loaded (CSOM behavior) ClientContext.Load(listItem); + ClientContext.Load(listItem, l => l.Include(RetrievalExpressions)); if (IncludeContentType) { ClientContext.Load(listItem, l => l.Include(a => a.ContentType, a => a.ContentType.Id, a => a.ContentType.Name, a => a.ContentType.Description, a => a.ContentType.StringId)); @@ -156,7 +160,9 @@ protected override void ExecuteCmdlet() do { var listItems = list.GetItems(query); + // Call ClientContext.Load() with and without retrievalExpressions to load FieldValues, otherwise no fields will be loaded (CSOM behavior) ClientContext.Load(listItems); + ClientContext.Load(listItems, l => l.Include(RetrievalExpressions)); if (IncludeContentType) { ClientContext.Load(listItems, l => l.Include(a => a.ContentType, a => a.ContentType.Id, a => a.ContentType.Name, a => a.ContentType.Description, a => a.ContentType.StringId));