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 bug #2000 broken error messages (output contained variable name as string) #2002

Merged
merged 5 commits into from
Jun 21, 2022
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]
Expand Down
11 changes: 3 additions & 8 deletions src/Commands/Utilities/ListItemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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<FieldUpdateValue>();

var context = item.Context as ClientContext;
Expand Down Expand Up @@ -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 + "'.");
}
}

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -304,7 +300,6 @@ public static void SetFieldValues(this ListItem item, Hashtable valuesToSet, Cmd
}
}
}

}

public static Dictionary<string, object> GetFieldValues(PnP.Core.Model.SharePoint.IList list, PnP.Core.Model.SharePoint.IListItem existingItem, Hashtable valuesToSet, ClientContext clientContext, PnPBatch batch)
Expand Down