FindMeetingTimes with TimeConstraint returns ErrorInternalServerError

FindMeetingTimes with TimeConstraint returns ErrorInternalServerError

使用 Graph API 我提出了一个类似于下面的请求。

出于某种原因,当我包含 TimeConstraint 时,我得到了一个空指针。如果我不包含 TimeConstraint 节点,请求将成功返回。

对我来说,我的 TimeConstraint 部分看起来不错。有什么问题或者我遗漏了什么吗?

异常:

{
  "error": {
    "code": "ErrorInternalServerError",
    "message": "Object reference not set to an instance of an object.",
    "innerError": {
      "request-id": "905b8b0f-5de2-4559-861d-4244aa25da7c",
      "date": "2017-11-21T13:48:32"
    }
  }
}

要求:

{
   "Attendees":[
      {
         "type":"required",
         "emailAddress":{
            "address":"user1@tenant.com"
         }
      },
      {
         "type":"required",
         "emailAddress":{
            "address":"user2@tenant.com"
         }
      },
      {
         "type":"required",
         "emailAddress":{
            "address":"user3@tenant.com"
         }
      }
   ],
   "LocationConstraint":{
      "locations":[
         {
            "resolveAvailability":true,
            "locationEmailAddress":"room@tenant.com"
         }
      ]
   },
   "TimeConstraint":{
      "activityDomain":"work",
      "timeslots":[
         {
            "start":{
               "dateTime":"2017-11-26T09:00:00",
               "timeZone":"Pacific Standard Time"
            }
         },
         {
            "end":{
               "dateTime":"2017-11-26T17:00:00",
               "timeZone":"Pacific Standard Time"
            }
         }
      ]
   },
   "MeetingDuration":"PT1H",
   "MaxCandidates":99,
   "IsOrganizerOptional":false,
   "ReturnSuggestionReasons":true,
   "MinimumAttendeePercentage":100.0
}

您的 startandend` 属性范围太远了一级。这些是同一对象的属性:

试试这个:

"timeslots": [{
    "start": {
        "dateTime": "2017-11-23T16:58:07.973Z",
        "timeZone": "Eastern Standard Time"
    },
    "end": {
        "dateTime": "2017-11-30T16:58:07.973Z",
        "timeZone": "Eastern Standard Time"
    }
}]

使用 Microsoft Graph .NET 客户端 SDK 时:

// Create TimeConstraint
TimeConstraint timeConstraint = new TimeConstraint();
timeConstraint.ActivityDomain = ActivityDomain.Unrestricted;

// Create a TimeSlot
TimeSlot timeSlot = new TimeSlot();
timeSlot.Start.DateTime = "2017-11-23T16:58:07.973Z";
timeSlot.Start.TimeZone = "Eastern Standard Time";
timeSlot.End.DateTime = "2017-11-30T16:58:07.973Z";
timeSlot.End.TimeZone = "Eastern Standard Time";

// Create a TimeSlot collection and add the TimeSlot
List<TimeSlot> timeSlots = new List<TimeSlot>();
timeSlots.Add(timeSlot);

// Assign the TimeSlot collection to the TimeContraint
timeConstraint.Timeslots = timeSlots;