Skip to content

Remove duplicate ID property from logged ListItem endpoints ID/Id #5463

@martinlingstuyl

Description

@martinlingstuyl

When using PowerShell, people usually pipe their output into the PowerShell JSON converter to be able to use the output in scripting:

$listitems = m365 spo listitem list [options] | ConvertFrom-Json

However, the ConvertFrom-Json commandlet is not case-sensitive, and hence cannot handle multiple properties that are named the same. For example, the following response from the spo items api will break the commandlet:

[
    {
        "Id": 1
        "ID": 1
        "Title": "Some title"
    }
]

to work around this you can use the ConvertFrom-Json -AsHashTable flag, but it's not ideal.

to fix this, in some places, the ID property is being deleted from the response, before being logged. For example in listitem-list and listitem-get.

listItems.forEach(v => delete v['ID']);
await logger.log(listItems);

There are a few places where it's not being deleted. We need to fix those.

Commands to update

  • spo listitem add
  • spo listitem set
  • spo tenant applicationcustomizer list
  • spo tenant commandset list
  • spo file get
  • spo page list
  • spo page get

There may be more, but this was all I found..

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions