jhoneill / MsftGraph

A PowerShell module for interacting with the Microsoft Graph API for Directory, OneNote, OneDrive, Outlook, Planner, Teams and Sharepoint in Office 365 or consumer versions
MIT License
93 stars 12 forks source link

ggu : New-Object : The member "refreshTokensValidFromDateTime" was not found #10

Closed i-windows closed 2 years ago

i-windows commented 2 years ago

steps to produce error : ggu -userid user@somwhere

error reported : New-Object : The member "refreshTokensValidFromDateTime" was not found for the specified .NET object. At C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.PlusPlus\1.5.3\Users.ps1:19 char:29

running environment OS windows 11 module version 1.5.3 graph version : latest powershell, 5.1 & 7 verified on two machines.

comments in convertTo-GraphUser helper function we can just remove the refreshTokensValidfromDate, this resolves the Issue. $null = $r.manager.remove('@odata.type'),$r.manager.remove('@odata.id'),$r.manager.remove('authorizationInfo'),$r.manager.remove('refreshTokensValidFromDateTime')

jhoneill commented 2 years ago

This the graph API adding some extra properties which are not known to the current .NET objects.

It is likely that a new version of SDK modules will support these extra properties. But I will fix this one and check that one there is a new a release. If you encounter any more please open issues or PRs for each one.

jhoneill commented 2 years ago

Checking this I've found the current version Microsoft.Graph.Users 1.9.3 already supports refreshTokensValidFromDateTime so it may be that just updating the module will fix this.

i-windows commented 2 years ago

we are using the latest graph module 1.10.0, if we try 1.9.6, we also get an error but slightly different The value supplied is not valid, or the property is read-only. Change the value, and then try again.

but you can see the property in the model.

with latest graph 1.10.0 the property has been removed from the object, but seems to be returned by the API.

jhoneill commented 2 years ago

OK I'll remove the property - even if only as a temporary thing.