Home > database >  Calling Update-MgPlace cmdlet not working
Calling Update-MgPlace cmdlet not working

Time:04-12

I'm trying to patch a Place using the cmdlet Update-MgPlace

$addProp = @{
floorNumber = 1
capacity = 15
}

Update-MgPlace -PlaceId <myRoomId> -AdditionalProperties $addProp

Getting this error

Update-MgPlace_UpdateExpanded : Update request has to be for a tenant Room or RoomList. Au caractère C:\Users\XXXX\Documents\WindowsPowerShell\Modules\Microsoft.Graph.Calendar\1.9.0\exports\v1.0\ProxyCmdletDefinitions.ps1:17598 : 23 $scriptCmd = {& $wrappedCmd @PSBoundParameters}

CategoryInfo : InvalidOperation : ({ PlaceId = c62...oftGraphPlace }:<>f__AnonymousType872) [Update-MgPlace_UpdateExpanded], RestException1
FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.UpdateMgPlace_UpdateExpanded

With the same administrator account and required permissions, I sucessfully update the Place using Graph Explorer :

{
    "@odata.type": "#microsoft.graph.room",
    "capacity": "15",
    "floorNumber": "1"
}

CodePudding user response:

You need to specify -BodyParameter instead of -AdditionalProperties.

In the request body, use @odata.type to specify the type of place.

$params = @{
"@odata.type" = "microsoft.graph.room"
floorNumber = 1
capacity = 15
}

Update-MgPlace -PlaceId <myRoomId> -BodyParameter $params
  • Related