Skip to content

[Support Setting Fields to null] Unable to set BusinessPhones or MobilePhone fields to $null #833

Open
@haneef95

Description

@haneef95

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions