Domanda

Calling the following code:

$uri = "https://graph.microsoft.com/v1.0/groups/[groupID]/members/`$ref"
$body = (@{'@odata.id'='https://graph.microsoft.com/v1.0/directoryObjects/[memberID]'} | ConvertTo-JSON)
Invoke-WebRequest -Method "POST" -Uri $uri -ContentType "application/json" -Headers @{Authorization = "Bearer $retrievedToken"} -Body $body -UseBasicParsing -Verbose

Returns:

Invoke-WebRequest : { "error": { "code": "Request_BadRequest", "message": "No URI value was found for
an entity reference link. A single URI value was expected."

Obs.: The same request in Graph Explorer works as expected.

È stato utile?

Soluzione

Worked with:

$uri = "https://graph.microsoft.com/v1.0/groups/[groupID]/members/`$ref"
$body = (@{'@odata.id'='https://graph.microsoft.com/v1.0/directoryObjects/[MemberID]'} | ConvertTo-JSON)
Invoke-WebRequest -Method "POST" -Uri $uri -ContentType "application/json" -Headers @{Authorization = "Bearer $token"} -Body $body
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top