Reputation: 20179
Using Graph API I am positing a request similar to below.
For some reason, when I include the TimeConstraint
I get a null pointer. If I don't include the TimeConstraint
node, request is returned successfully.
To me, my TimeConstraint
section looks OK. Is there anything wrong or that I'm missing?
Exception:
{
"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"
}
}
}
Request:
{
"Attendees":[
{
"type":"required",
"emailAddress":{
"address":"[email protected]"
}
},
{
"type":"required",
"emailAddress":{
"address":"[email protected]"
}
},
{
"type":"required",
"emailAddress":{
"address":"[email protected]"
}
}
],
"LocationConstraint":{
"locations":[
{
"resolveAvailability":true,
"locationEmailAddress":"[email protected]"
}
]
},
"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
}
Upvotes: 1
Views: 369
Reputation: 33124
Your startand
end` properties are scoped one level too far. These are properties of the same object:
Try this instead:
"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"
}
}]
When using the Microsoft Graph .NET Client 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;
Upvotes: 1