PnP-PowerShell icon indicating copy to clipboard operation
PnP-PowerShell copied to clipboard

Clear-PnPDefaultColumnValues : Object reference not set to an instance of an object.

Open DamienFloody opened this issue 5 years ago • 6 comments

Reporting an Issue or Missing Feature

Issue

Clear-PnPDefaultColumnValues not working with managed metadata field.

Expected behavior

I am able to Set-PnPDefaultColumnValues without an issue. But when I try to Clear-PnPDefaultColumnValues I receive the below error. The field in this case is a Managed Metadata field

Actual behavior

Clear-PnPDefaultColumnValues -List "DL1" -Folder "/Hello" -Field "Topic"

Clear-PnPDefaultColumnValues : Object reference not set to an instance of an object.
At line:1 char:1
+ Clear-PnPDefaultColumnValues -List "DL1" -Folder "/Hello" -Field "Top ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Clear-PnPDefaultColumnValues], NullReferenceException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Lists.ClearDefaultColumnValues

Steps to reproduce behavior

Set-PnPDefaultColumnValues -List "DL1" -Folder "/Hello" -Field "Topic" -Value "62fe7219-0ec3-42ac-96"

Clear-PnPDefaultColumnValues -List "DL1" -Folder "/Hello" -Field "Topic"

Clear-PnPDefaultColumnValues : Object reference not set to an instance of an object.
At line:1 char:1
+ Clear-PnPDefaultColumnValues -List "DL1" -Folder "/Hello" -Field "Top ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Clear-PnPDefaultColumnValues], NullReferenceException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Lists.ClearDefaultColumnValues

Get-PnPException

Message          : Object reference not set to an instance of an object.
Stacktrace       :    at Microsoft.SharePoint.Client.ListExtensions.<>c__DisplayClass72_1.<ClearDefaultColumnValues>b__
                   6(IDefaultColumnValue c)
                      at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
                      at Microsoft.SharePoint.Client.ListExtensions.ClearDefaultColumnValues(List list, IEnumerable`1
                   columnValues)
                      at SharePointPnP.PowerShell.Commands.Lists.ClearDefaultColumnValues.ExecuteCmdlet()
                      at SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()
ScriptLineNumber : 1

Which version of the PnP-PowerShell Cmdlets are you using?

  • [ ] PnP PowerShell for SharePoint 2013
  • [ ] PnP PowerShell for SharePoint 2016
  • [x] PnP PowerShell for SharePoint Online

What is the version of the Cmdlet module you are running?

SharePointPnPPowerShellOnline 3.7.1903.0

How did you install the PnP-PowerShell Cmdlets?

  • [ ] MSI Installed downloaded from GitHub
  • [x] Installed through the PowerShell Gallery with Install-Module
  • [ ] Other means

DamienFloody avatar Mar 21 '19 13:03 DamienFloody

Any workarounds or fix?

ghost avatar May 13 '19 11:05 ghost

@jonikkrusesmith nothing as of yet...is it the same for you?

DamienFloody avatar May 16 '19 14:05 DamienFloody

Any news on this?

JimmyWessman avatar Aug 27 '19 11:08 JimmyWessman

We are also looking for an update on this - any news?

tbystrom avatar Nov 19 '19 12:11 tbystrom

Today I encountered the same issue. Any news?

zenlord avatar Sep 10 '20 17:09 zenlord

Had the same issue today.

adam13hylo avatar Nov 13 '20 17:11 adam13hylo