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
[Support Setting Fields to null] Unable to set BusinessPhones or MobilePhone fields to $null #833
Comments
Please push this on top of requirement list, $null should be supported as we have in Set-MSOLUser. The workaround needs extra handling and additional calls. It would be good if an ETA is shared. |
This needs to be updated/fixed such that the "OtherMails" attribute can also be set to null. This module needs to be at parity with MSOnline before it is retired. Please expedite. |
Any updates to this? |
Invoke-GraphRequest fails on the latest module version 1.14.0. You can use Invoke-MgGraphRequest instead. Invoke-MgGraphRequest -Method PATCH -Uri "https://graph.microsoft.com/v1.0/uers/ -Body "{ As multiple customers are facing this issue, please fix this asap. |
@rui0122, the workaround works well for me in The issue is with the spelling of |
When will this issue be fixed? |
While this doesn't excuse the lack of progress on this, This is a decent workaround:
|
@yllekz , Thanks for the workaround guide. However, this workaround requires an extra command to be executed. |
It's only one command. The first line is just a variable assignment for convenience. You don't have to write it that way if you don't want to. |
We currently do not support setting properties to null due to a design limitation with the code generator - Azure/autorest.powershell#961. As a workaround, please use the |
Unfortunately Invoke-GraphRequest doesn't seem to work to null values either. It appears to be the same through Graph Explorer. Can someone help get this info to the Graph API team? |
@nathankascopgr, please open a question at https://developer.microsoft.com/en-us/graph/support to get assistance from the API owner. |
Seriously I am shocked that the APIs do not handle nulls, with this and the deleted items call failing to work at all, it calls into question the quality of this module. I wrote my own interface class a couple of year back because of the deleted items thing but this time I am attempting to use the new module, but come on guys, this is basic stuff. Now we have to have a special case for any null (and deleted items), how many more will I find? |
This is my workaround, I have a hashtable of values to update... there might be a more efficient way of setting up the hashtables, I've not had time to look yet.
|
We really need this! |
+1 |
Hi,
When trying to set BusinessPhones or MobilePhone values to $null, like so:
Update-MgUser -UserId $MgUser.UserPrincipalName -MobilePhone $null -BusinessPhones $null
It throws an error:
Update-MgUser_UpdateExpanded: Invalid value specified for property 'mobilePhone' of resource 'User'.
I've fixed this for now by using an alternative command:
Invoke-GraphRequest -Method PATCH -Uri "https://graph.microsoft.com/v1.0/Users/$($MgUser.UserPrincipalName)" -Body '{"businessPhones": [],"mobilePhone": null}'
Hope this helps someone else in a similar need and more so, the Update-MgUser cmdlet is fixed.
Thanks,
AB#10944
The text was updated successfully, but these errors were encountered: