Microsoft Graph API: คุณสมบัติการมอบหมาย (plannerAssignment) ของ Task Resource (plannerTask) ไม่ทำงาน

สวัสดี ฉันกำลังส่งคำขอโพสต์ไปยังกราฟ api (เบต้า) เพื่อสร้างงานกับผู้รับมอบหมายดังนี้

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://graph.microsoft.com/beta/planner/tasks",
  "method": "POST",
  "headers": {
    "content-type": "application/json",
    "authorization": "Bearer token",
    "cache-control": "no-cache",
    "postman-token": "f6dd56ab-6fb4-f553-74aa-792945ba98b6"
  },
  "data":  {"title": "testTask","planId": "rPWMLzwXlUOA33dPNU9-dWUAAoRf,  "assignments": {"7d0544e0-2ed9-4aab-92a0-38efcaa292cd": {"orderHint": '5637'    } } }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

แต่มันให้ Error ดังนี้

{
  "error": {
    "code": "",
    "message": "The request is invalid.",
    "innerError": {
      "request-id": "14a2ef00-a271-4be8-8197-71aa46379017",
      "date": "2017-04-18T11:29:42"
    },
    "innererror": {
      "message": "task : An error has occurred.\r\n"
    }
  }
}

ลิงก์ทรัพยากรงาน: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/plannertask


person selvakumar    schedule 18.04.2017    source แหล่งที่มา


คำตอบ (1)


ฉันเห็นปัญหาสองประการเกี่ยวกับคำขอ

  • สำหรับคุณสมบัติชนิดเปิด คุณต้องรวมประเภทของค่าประเภทที่ซับซ้อนของคุณสมบัติ ในกรณีนี้คือ "microsoft.graph.plannerAssignment"
  • คำแนะนำการสั่งซื้อที่ส่งไปในคำขอเป็นไปตามรูปแบบที่อธิบายไว้ ที่นี่ ข้อมูลที่คุณป้อนไม่ถูกต้องตามรูปแบบนั้น ในกรณีนี้ เนื่องจากนี่คือรายการแรก คำแนะนำลำดับจึงควรเป็น " !" คุณสามารถใช้ได้ " !" สำหรับคำแนะนำในการสั่งซื้อทั้งหมดให้สร้างขึ้นสำหรับคุณ หากคุณไม่สนใจเกี่ยวกับลำดับของรายการ

หลังจากทำการเปลี่ยนแปลงที่จำเป็นแล้ว คำขอของคุณควรมีลักษณะดังนี้:

{"title": "testTask","planId": "rPWMLzwXlUOA33dPNU9-dWUAAoRf, "assignments": {"7d0544e0-2ed9-4aab-92a0-38efcaa292cd": { "@odata.type": "microsoft.graph.plannerAssignment", "orderHint": " !"} } }
person Tarkan Sevilmis    schedule 19.04.2017