我的代码遵循此处指出的内容
https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/user_assignlicense
$datos=array("addLicenses"=>array(array("skuId"=>$sku)));
$this->graph->setApiVersion("beta");
$this->crear("users/$id_user/assignLicense", $datos);
public function crear($objeto, $datos){
$r = $this->graph->createRequest("POST", "/$objeto")
->attachBody($datos)
->execute();
}
错误
Type: GuzzleHttp\Exception\ClientException
Message: Client error: `POST
https://graph.microsoft.com/beta/users/USER_ID/assignLicense` resulted in a `400 Bad Request` response: {
"error": { "code": "Request_BadRequest", "message": "One or more parameters
of the function import 'assig (truncated...)
Filename: /var/www/html/ischooldesarrollo/application/libraries/msgraph-sdk-
php/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php
Line Number: 111
我的错误是什么?
答案 0 :(得分:2)
一些事情:
addLicenses
和removeLicenses
。我没有看到第二个。如果您只是添加许可证,请将removeLicenses
设置为空数组。addLicenses
数组是[disabledPlans
和skuId
]的数组,disabledPlans
本身就是一个数组。如果您不想禁用任何计划,只需将其设置为空数组。希望这有帮助,