diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa8eb940..b423e2d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,6 +99,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed `Update-PnPSiteClassification`, it was ignoring the `Settings` parameter. It will now be processed. [#1989](https://github.com/pnp/powershell/pull/1989) - Fixed `Register-PnPAzureADApp` issue with app creation after the connection related changes. [#1993](https://github.com/pnp/powershell/pull/1993) - Fixed `Get-PnPFileVersion` not able to correctly use piping on the returned object. [#1997](https://github.com/pnp/powershell/pull/1997) +- Fixed `Add-PnPListItem` not showing field name when it has an improper value assigned to it [#2002](https://github.com/pnp/powershell/pull/202) ### Removed @@ -108,6 +109,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Contributors +- Ali Robertson [alirobe] - Leif Frederiksen [Leif-Frederiksen] - Emily Mancini [eemancini] - Jim Duncan [sparkitect] diff --git a/src/Commands/Utilities/ListItemHelper.cs b/src/Commands/Utilities/ListItemHelper.cs index 6cdfbb02d..19a02f67d 100644 --- a/src/Commands/Utilities/ListItemHelper.cs +++ b/src/Commands/Utilities/ListItemHelper.cs @@ -9,8 +9,6 @@ using System.Globalization; using System.Linq; using System.Management.Automation; -using System.Text; -using System.Threading.Tasks; namespace PnP.PowerShell.Commands.Utilities { @@ -37,8 +35,6 @@ public FieldUpdateValue(string key, object value, string fieldTypeString) public static void SetFieldValues(this ListItem item, Hashtable valuesToSet, Cmdlet cmdlet) { - // xxx: return early if hashtable is empty to save getting fields? - var itemValues = new List(); var context = item.Context as ClientContext; @@ -135,7 +131,7 @@ public static void SetFieldValues(this ListItem item, Hashtable valuesToSet, Cmd } else { - cmdlet.WriteWarning($@"Unable to find the specified term.Skipping values for field ""{field.InternalName}"""); + cmdlet.WriteWarning("Unable to find the specified term. Skipping values for field '" + field.InternalName + "'."); } } @@ -159,7 +155,7 @@ public static void SetFieldValues(this ListItem item, Hashtable valuesToSet, Cmd } else { - cmdlet.WriteWarning($@"You are trying to set multiple values in a single value field. Skipping values for field ""{field.InternalName}"""); + cmdlet.WriteWarning("You are trying to set multiple values in a single value field. Skipping values for field '" + field.InternalName + "'."); } } else @@ -176,7 +172,7 @@ public static void SetFieldValues(this ListItem item, Hashtable valuesToSet, Cmd if (taxonomyItem == null) { updateTaxItemValue = false; - cmdlet.WriteWarning($@"Unable to find the specified term.Skipping values for field ""{field.InternalName}"""); + cmdlet.WriteWarning("Unable to find the specified term. Skipping values for field '" + field.InternalName + "'."); } } else @@ -304,7 +300,6 @@ public static void SetFieldValues(this ListItem item, Hashtable valuesToSet, Cmd } } } - } public static Dictionary GetFieldValues(PnP.Core.Model.SharePoint.IList list, PnP.Core.Model.SharePoint.IListItem existingItem, Hashtable valuesToSet, ClientContext clientContext, PnPBatch batch)