Get-PnPListItem Value cannot be null

Copper Contributor

I've hit an issue in a couple of document libraries when running Get-PnPListItem to retrieve all documents I get a "Value cannot be null" response:

 

$items = Get-PnPListItem -List "Shared Documents" -PageSize 500

Get-PnPListItem : Value cannot be null.
Parameter name: termId
At line:1 char:10
+ $items = Get-PnPListItem -PageSize 500
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Get-PnPListItem], ServerException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Lists.GetListItem

 

Has anyone seen this before? IS there any way of determining what item/term is causing the error?

3 Replies

Hey @jrmcloughlin,

 

A few questions to help understand your problem:

 

  • Are you using the latest version of PnP PowerShell? 
  • Does this problem happen only to the Shared Documents library?
  • Do you have permission to read/ edit this list?

 

Regards,

@Carlos_Marins 

  • Yes
  • Shared Documents is the only library we have on each site. We have hundreds of sites and I've only seen this issue on 2 of them
  • I'm site collection admin

Thanks

Hi @jrmcloughlin ,

 

So, making a quick search all I could find was this question on Stack Exchange. It seems like a single item could be causing problem due to its metadata. Can you try to query a single item from this library and see if it works? Maybe by querying different items you can track it down to a single file that's causing the issue. Let me know if it helps.

 

Regards