- 
                Notifications
    
You must be signed in to change notification settings  - Fork 212
 
Closed
Description
I am using Update-MgUser to update OfficeLocation values and sometimes when a person is between locations, or not yet assigned a location, we want the location field to be empty. But if I pass either an empty string or $nul the cmdlet fails. How do I remove the OfficeLocation value. We don't want to populate it with garbage!
PS C:\admin\365\SharePoint> Update-MgUser -UserId $User.Id -OfficeLocation ""
Update-MgUser : Invalid value specified for property 'officeLocation' of resource 'User'.
At line:1 char:1
+ Update-MgUser -UserId $User.Id -OfficeLocation ""
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ UserId = 7ce2...oftGraphUser1 }:<>f__AnonymousType63`2) [Update-MgUser_UpdateExpanded], RestException`1
    + FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.UpdateMgUser_UpdateExpanded
Metadata
Metadata
Assignees
Labels
No labels