msgraph-sdk-ruby icon indicating copy to clipboard operation
msgraph-sdk-ruby copied to clipboard

No HTTP response with MicrosoftGraph Create Event

Open loganh0522 opened this issue 8 years ago • 7 comments

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

loganh0522 avatar Jul 18 '17 20:07 loganh0522

Thanks for reporting this. It looks like this is a bug in the library.

caitlinrussell avatar Jul 21 '17 16:07 caitlinrussell

@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?

loganh0522 avatar Jul 21 '17 17:07 loganh0522

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

caitlinrussell avatar Jul 21 '17 18:07 caitlinrussell

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.

loganh0522 avatar Jul 21 '17 18:07 loganh0522

Unfortunately, we are low on resources right now so it could be quite a while.

caitlinrussell avatar Jul 21 '17 18:07 caitlinrussell

@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.

  1. 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/>>

  2. 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

loganh0522 avatar Jul 24 '17 02:07 loganh0522

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

caitlinrussell avatar Jul 24 '17 15:07 caitlinrussell

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.

baywet avatar Jan 10 '23 19:01 baywet