Microsoft Graph api 无法发送共享文档的邀请
Microsoft Graph api cannot send invitation to share document
我的目标是与其他用户分享 document/file。
我正在使用 https://docs.microsoft.com/en-us/graph/api/driveitem-invite?view=graph-rest-1.0&tabs=http 来做。
我有错误:
Client error: POST https://graph.microsoft.com/v1.0/me/drive/root:/operations.xlsx:/invite resulted in a 400 Bad Request response: {"error":{"code":"BadRequest","message":"The request is malformed or incorrect. Expected array for value of property: Collection(microsoft.graph.driveRecipient)","innerError":{"date":"2022-03-08T10:48:30","request-id":"xxx-xxxx-xxxxx","client-request-id":"xxx-xxxx-xxxxx"}}}
在下面找到我的代码:
operations.xlsx 是我要共享的文件。
public function send(){
$viewData = $this->loadViewData();
$graphs = $this->getGraph();
$body = array(
"requireSignIn"=> true,
"sendInvitation" => true ,
"roles" => "[write | read]",
"recipients"=>array(
"email"=> "person@email.com"
),
"message"=> "Here is the file."
);
$graphs->createRequest("post", "/me/drive/root:/operations.xlsx:/invite")
->attachBody($body)
->execute();
return response()->json($graphs);
}
我正在为项目使用 Laravel。
public function sended(){
$viewData = $this->loadViewData();
$graphs = $this->getGraph();
$body = array(
"requireSignIn"=> true,
"sendInvitation" => true ,
"roles" => ["read"],
"recipients"=>array([
"email"=> "person@email.com"
]),
"message"=> "Here is the file."
);
$graphs->createRequest("post", "/me/drive/root:/operations.xlsx:/invite")
->attachBody($body)
->execute();
return response()->json($graphs);
}
我的目标是与其他用户分享 document/file。
我正在使用 https://docs.microsoft.com/en-us/graph/api/driveitem-invite?view=graph-rest-1.0&tabs=http 来做。
我有错误:
Client error: POST https://graph.microsoft.com/v1.0/me/drive/root:/operations.xlsx:/invite resulted in a 400 Bad Request response: {"error":{"code":"BadRequest","message":"The request is malformed or incorrect. Expected array for value of property: Collection(microsoft.graph.driveRecipient)","innerError":{"date":"2022-03-08T10:48:30","request-id":"xxx-xxxx-xxxxx","client-request-id":"xxx-xxxx-xxxxx"}}}
在下面找到我的代码:
operations.xlsx 是我要共享的文件。
public function send(){
$viewData = $this->loadViewData();
$graphs = $this->getGraph();
$body = array(
"requireSignIn"=> true,
"sendInvitation" => true ,
"roles" => "[write | read]",
"recipients"=>array(
"email"=> "person@email.com"
),
"message"=> "Here is the file."
);
$graphs->createRequest("post", "/me/drive/root:/operations.xlsx:/invite")
->attachBody($body)
->execute();
return response()->json($graphs);
}
我正在为项目使用 Laravel。
public function sended(){
$viewData = $this->loadViewData();
$graphs = $this->getGraph();
$body = array(
"requireSignIn"=> true,
"sendInvitation" => true ,
"roles" => ["read"],
"recipients"=>array([
"email"=> "person@email.com"
]),
"message"=> "Here is the file."
);
$graphs->createRequest("post", "/me/drive/root:/operations.xlsx:/invite")
->attachBody($body)
->execute();
return response()->json($graphs);
}