-
Notifications
You must be signed in to change notification settings - Fork 167
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
non-powershell experience with getting field values from Get-MgSiteListItem #1659
Comments
To work around this I am having to do things like the following
|
Thanks for bringing this to our attention. The type of A hashtable is a valid PowerShell type that provides a few advantages over an object. With a hashtable, you must enumerate over the collection to access its elements. What you have in your workaround is exactly how a hashtable is meant to be cast into a PSCustomObject. Alternatively, you can look at the workaround in https://stackoverflow.com/questions/72384632/possible-to-pull-info-from-additionalproperties-dictionary-with-microsoft-graph. I agree with you that using a hashtable is tedious, and I'll surface this to the AutoREST to see if we can simplify the use of |
Thanks @peombwa. So you are saying that AutoREST is producing mixed PSObject and hashtable experience in the produced object? I'm sure they are doing that for some reason but it feels like consistently producing one or the other would create easier to use models. I don't think I'd mind whether a PSObject or Hashtable, just as long as it was consistennt. The two work quite differently and most people are not PowerShell experts, they are using it to get an automation job done. I'm willing to bet that >90% of users of this API will be trying to get to the column values of their list. Better, more discoverable, documentation focused on these issues would be the second best option here. Thanks for supporting improvements to this area. |
I can see from this #764 that we have to go to the AdditionalProperties to get the field values for a list these which is functional but not in keeping with the nature of this SDK - i.e. it isn't very powershell.
It seems to be that 99% of the time this function will be used to get the field values Get-MgSiteListItem - is there a reason why these haven't been wrapped and presented as PSObjects? It just makes for a more difficult experience as we now have to navigate hashtables as well as psobjects - it would be great if it could be consistent.
The text was updated successfully, but these errors were encountered: