0
jquery를 사용하여 지금까지 항목 복사 요청 (POST/me/drive/items/copy), 을 보내도록 관리했습니다. 권한 (POST/드라이브/항목 // 초대)을 추가하면 "지원되지 않는 세그먼트 유형"오류가 발생합니다.OneDrive API가 포함 된 Microsoft Graph, 초대 : 지원되지 않는 세그먼트 유형으로 실패
API 설명서 : 이
(I 비교하기 위해 두 가지 기능을 복사) graph.microsoft.io/en-us/docs/api-reference/v1.0/api/item_invite
// working:
copyFile:function(id, folderId){
// https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/item_copy
// POST /me/drive/items/<id>/copy
var endpointUrl = 'https://graph.microsoft.com/v1.0/me/drive/items/'+id+'/copy';
var data={};
data.parentReference={'id':folderId}
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Content-Type","application/json");
xhrObj.setRequestHeader("Accept","application/json");
},
processDate: false,
datatype : "json",
method: "POST",
//http://stackoverflow.com/questions/13956462/jquery-post-sends-form-data-and-not-json
data: JSON.stringify(data),
url: endpointUrl,
contentType : 'application/json',
headers : { "authorization" : "Bearer " + token }
}).success(function(data) {
alert('success!')
});
},
///NO WORKING ?
invite:function(id, user){
// http://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/item_invite
// POST /drive/items/<id>/invite
var endpointUrl = 'https://graph.microsoft.com/v1.0/drive/items/'+id+'/invite';
data={
"requireSignIn": true,
"sendInvitation": false,
"roles": "read",
"recipients": [ { "email": user }],
"message": "NO MESSAGE ?"
}
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Content-Type","application/json");
xhrObj.setRequestHeader("Accept","application/json");
},
datatype : "json",
method: "POST",
data: JSON.stringify(data),
url: endpointUrl,
contentType : 'application/json',
headers : {"authorization" : "Bearer " + token}
}).success(function(data) {
alert('success!')
});
API 리턴 :
{
"error": {
"code": "BadRequest",
"message": "Unsupported segment type. ODataQuery: drive/items/***********/invite",
"innerError": {
"request-id": "********",
"date": "2016-09-14T09:01:32"
}
}
}
내가 뭔가를 놓친 건가?