No HTTP response with MicrosoftGraph Create Event
I am able to get, post, for calendar and emails with MicrosoftGraph api, but the api does not return a JSON response object.
Here is the code I am using to create an event, any guidance as to access response codes and messages is much appreciated, as I need them for validation purposes. The code below successfully adds events to a users calendar. just trying to get json response object.
def self.create_event(user, dateTime, endTime)
if user.outlook_token.expired?
user.outlook_token.refresh!(user)
end
callback = Proc.new do |r|
r.headers['Authorization'] = "Bearer #{user.outlook_token.access_token}"
r.headers['Content-type'] = 'application/json'
r.headers['X-AnchorMailbox'] = user.email
end
graph = MicrosoftGraph.new(base_url: 'https://graph.microsoft.com/v1.0',
&callback)
@create = graph.me.events.create(messageHash)
end
Thanks for reporting this. It looks like this is a bug in the library.
@cbales Please let me know if you need anymore information to help you. Do you have any suggestions I can use to work around this in the meantime?
The only workaround I can think of at the moment is to do another GET on events with a filter for the one you added
Okay thank you for the suggestion. Just out of curiosity, when might this bug be resolved, so I know when to check back in ? I really appreciate quick response and support.
Unfortunately, we are low on resources right now so it could be quite a while.
@cbales That is fine I totally understand, I am having some difficulties with a couple of things, and it would really help me out if you had an answer.
-
How can I override the the base functionality to return v2.0 of microsoft graph. I currently do graph = MicrosoftGraph.new(base_url: 'https://graph.microsoft.com/v2.0/', &callback) but I am still returned <MicrosoftGraph:0x007 @association_collections={}, @service=#<OData::Service https://graph.microsoft.com/v1.0/>>
-
Is there a way to update an existing event, without deleting and creating a new one. I have tried everything I can think of to achieve this, I think I just can't get right syntax.
Sorry to bother you with this, I really appreciate you letting me know about these two things.
Logan
I'm not sure I understand part 1. There is no Graph v2.0. For part 2, you can PATCH the existing event: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/event_update
Thanks for reporting this issue. That version of the SDK has been deprecated a number of years ago. We're now starting the work on a new generation of this SDK and you can learn all about it on the updated readme page.