msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Get-MgSiteListItem does not return Number field value

Open Attila-FIN opened this issue 3 years ago • 2 comments

List items with all the field values can be received by executing

Get-MgSiteListItem -SiteId $SiteiD -ListId $ListId -All -ExpandProperty Fields

However, when a SharePoint list field is a Number type, the returned value is empty. Changing the field type in SharePoint to Singe line of text the correct value is returned.

Module: Microsoft.Graph.Sites Module version: 1.9.2

Attila-FIN avatar Mar 03 '22 21:03 Attila-FIN

@Attila-FIN, this works on my end without any issue. From my testing, it looks like the service won't return a field if it has no value:

image image

peombwa avatar Mar 04 '22 22:03 peombwa

This is the result of $ListItems[0].Fields.AdditionalProperties when having the columns as single line of text:

image

In SharePoint it looks like this:

image

If I change the columns to Number, the result in PowerShell:

image

In SharePoint it looks like this:

image

If I change back to text, the column values are available in PowerShell.

Attila-FIN avatar Mar 05 '22 20:03 Attila-FIN

This behavior is still not reproducible using the latest version of the module.

Steps followed:

  1. Add PostCode column of single line of text type to a list item. PostCode is returned in AdditionalProperties as string: image image

  2. Change PostCode column to Number. PostCode is returned in AdditionalProperties as single: image image

Please use -Debug switch to confirm that the field is included in the response from the service.

peombwa avatar Feb 09 '23 20:02 peombwa

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

ghost avatar Feb 13 '23 22:02 ghost

I am experiencing the exact same thing. I am on the newest version of Graph.

andersidahl avatar Sep 06 '23 13:09 andersidahl