通过PHP Graph SDK,我试图将用户实际分配给企业应用程序。但是,我收到以下错误:
Unsupported segment type. ODataQuery: users/{user-id}...
这是我的功能
public function assignUserToApp($user,$app)
{
$token = $this->getToken();
$graph = new Graph();
$graph->setAccessToken($token)
->setApiVersion('beta');
$newMemberRef = '/users/'.$user->getId().'/appRoleAssignments';
$response = $graph->createRequest('PATCH', $newMemberRef)
->attachBody([
"principalId" => $user->getId(),
"principalType" => "User",
"resourceId" => $app,
"creationTimestamp" => gmdate("Y-m-d\TH:i:s\Z")])
->execute();
}
我将非常感谢任何形式的帮助。
答案 0 :(得分:0)
updating /appRoleAssignments
的原型是:
PATCH /users/{userId}/appRoleAssignments/{appRoleId}
您错过了请求中的/{appRoleId}
。