Closed sled closed 2 weeks ago
Hi @sled Thanks for using the Ruby SDK and for reaching out. Are you setting the field yourself in the code? What happens if you do? Can you share a code snippet of the call you're making?
@baywet I tried to create a simple calendar event as follows:
new_event = MicrosoftGraph::Models::Event.new.tap do |event|
event.start = MicrosoftGraph::Models::DateTimeTimeZone.new.tap do |value|
value.date_time = '2023-10-30T10:00:00.0000000'
value.time_zone = 'UTC'
end
event.end_escaped = MicrosoftGraph::Models::DateTimeTimeZone.new.tap do |value|
value.date_time = '2023-10-30T12:00:00.0000000'
value.time_zone = 'UTC'
end
event.subject = 'A simple test'
event.body = MicrosoftGraph::Models::ItemBody.new.tap do |body|
body.content_type = :html
body.content = 'Trying to create a calendar item'
end
event.location = MicrosoftGraph::Models::Location.new.tap do |location|
location.address = MicrosoftGraph::Models::Location.new.tap do |address|
address.display_name = 'Somewhere'
end
end
event.reminder_minutes_before_start = 15
event.show_as = :busy
end
a_graph_client_instance.users.by_user_id('some@principal-name.com').calendar.events.post(new_event)
(Before the above actually sends something, I had to address the issues mentioned in https://github.com/microsoft/kiota-abstractions-ruby/issues/8 and https://github.com/microsoft/kiota-serialization-json-ruby/issues/20)
This sends the following payload (note the empty @odata.type
fields in the inner objects):
{
"id": null,
"@odata.type": "#microsoft.graph.event",
"changeKey": null,
"createdDateTime": null,
"lastModifiedDateTime": null,
"allowNewTimeProposals": null,
"body": {
"content": "Trying to create a calendar item",
"contentType": "html",
"@odata.type": null
},
"bodyPreview": null,
"end": {
"dateTime": "2023-10-30T12:00:00.0000000",
"@odata.type": null,
"timeZone": "UTC"
},
"hasAttachments": null,
"hideAttendees": null,
"iCalUId": null,
"importance": "",
"isAllDay": null,
"isCancelled": null,
"isDraft": null,
"isOnlineMeeting": null,
"isOrganizer": null,
"isReminderOn": null,
"location": {
"address": {
"displayName": "Somewhere",
"locationEmailAddress": null,
"locationType": "",
"locationUri": null,
"@odata.type": null,
"uniqueId": null,
"uniqueIdType": ""
},
"displayName": null,
"locationEmailAddress": null,
"locationType": "",
"locationUri": null,
"@odata.type": null,
"uniqueId": null,
"uniqueIdType": ""
},
"onlineMeetingProvider": "",
"onlineMeetingUrl": null,
"originalEndTimeZone": null,
"originalStart": null,
"originalStartTimeZone": null,
"reminderMinutesBeforeStart": 15,
"responseRequested": null,
"sensitivity": "",
"seriesMasterId": null,
"showAs": "busy",
"start": {
"dateTime": "2023-10-30T10:00:00.0000000",
"@odata.type": null,
"timeZone": "UTC"
},
"subject": "A simple test",
"transactionId": null,
"type": "",
"webLink": null
}
Thanks for the additional information here.
can you try to add `odata_type = "#microsoft.graph.dateTimeTimeZone" for the dateTimeTimeZone objects? (and do the same for other objects that are missing the odata type)
As for the other issues, thanks for the nudge, I realized I wasn't subscribed to the repository 🤦♂️
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
I ran into this error:
then I checked the payload and noticed that some models are missing the
odata_type
property, e.g.MicrosoftGraph::Models::DateTimeTimeZone https://github.com/microsoftgraph/msgraph-sdk-ruby/blob/main/lib/models/date_time_time_zone.rb
MicrosoftGraph::Models::ItemBody https://github.com/microsoftgraph/msgraph-sdk-ruby/blob/main/lib/models/item_body.rb
MicrosoftGraph::Models::Location https://github.com/microsoftgraph/msgraph-sdk-ruby/blob/main/lib/models/location.rb
and many more, however it is set in other models like:
MicrosoftGraph::Models::Event https://github.com/microsoftgraph/msgraph-sdk-ruby/blob/main/lib/models/event.rb#L232