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

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

Closed
7 tasks done
martinlingstuyl opened this issue Sep 6, 2023 · 0 comments
Closed
7 tasks done

Comments

@martinlingstuyl
Copy link
Contributor

martinlingstuyl commented Sep 6, 2023

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant