exchanger icon indicating copy to clipboard operation
exchanger copied to clipboard

Exchanger::Operation::ResponseError creating calendar items

Open link82 opened this issue 12 years ago • 14 comments

Hello, I'm trying to create a calendar event but when saving it complains I need to specify a "SendMeetingInvitations" attribute. I cannot find where to set it up, is that an issue or do i miss to configure anything?

I'm connected to a MS Exchange 2010 server.

Here is the error description: <Exchanger::Operation::ResponseError: The SendMeetingInvitations attribute is required for calendar items.>

Here is my code:

Exchanger::Client.new
cal = Exchanger::Folder.find(:calendar,'[email protected]')

@item = cal.new_calendar_item
@item.subject = "Launch time!!"
@item.start = Time.parse('2012-06-27 13:00:00')
@item.end = Time.parse('2012-06-27 14:00:00')
@item.is_all_day_event = false
@item.location = 'Room 1'
@item.is_meeting = false

@item.save()

Thank you in advance, Davide

link82 avatar Jun 27 '12 11:06 link82

Sorry, I currently don't have access to Exchange server, but I can try to direct you to the right direction.

Exchanger's CreateItem operation currently doesn't support SendMeetingInvitations attribute.

You can try adding a send_meeting_invitations option here

And also override CalendarItem#create method with CreateItem.run(:folder_id => parent_folder_id.id, :items => [self], :send_meeting_invitations => "SendToAllAndSaveCopy").

More details - http://msdn.microsoft.com/en-us/library/aa564690.aspx

ebeigarts avatar Jun 27 '12 12:06 ebeigarts

Thank you! I'm going to try this way.

I was trying to ovverride "to_xml" method in element class but the schema validation failed sending a CalendarItem with this additional attribute.

link82 avatar Jun 27 '12 13:06 link82

it works!! I need to make some changes but it worked.

link82 avatar Jun 27 '12 16:06 link82

Can you create a pull request for this?

ebeigarts avatar Jun 29 '12 08:06 ebeigarts

As soon as possible i will handle the generation of the custom attribute required when "SendMeetingAttributes" is equal to "SendToAllAndSaveCopy" and then I'll create a pull request.

I want to advise you I'm a newbie of rails, maybe I will need your support.

link82 avatar Jun 29 '12 15:06 link82

Ok, soon I will create the pull request.

I just want to check if it works sending requests to my meeting attendees but something is wrong in my code. How can I specify required / optional attendees for a meeting ?

@item.required_attendees = [ Exchanger::Attendee.new(:key => "mailbox", :text=> Exchanger::EmailAddress.new(:key => "EmailAdress", :text => "[email protected]"))]

Error:

#<Exchanger::Operation::ResponseError: The request failed schema validation: The element 'RequiredAttendees' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types' has invalid child element 'RequiredAttendees' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'. List of possible elements expected: 'Attendee' in namespace 'http://schemas.microsoft.com/exchange/services/2006/types'.>

link82 avatar Jul 06 '12 09:07 link82

@link82 @item.required_attendees = [ Exchanger::Attendee.new(:mailbox => Exchanger::Mailbox.new(:email_address => "[email protected]"))]

ebeigarts avatar Jul 10 '12 09:07 ebeigarts

Also you will need to add tag_name to Attendee class:


module Exchanger
  # The Attendee element represents attendees and resources for a meeting.
  #
  # http://msdn.microsoft.com/en-us/library/aa580339.aspx
  class Attendee < Element
    element :mailbox, :type => Mailbox
    element :response_type # Unknown Organizer Tentative Accept Decline NoResponseReceived
    element :last_response_time, :type => Time

    def tag_name
      "Attendee"
    end
  end
end

ebeigarts avatar Jul 10 '12 09:07 ebeigarts

I found it is also necessary to specify a new attribute while updating a calendar event, instead of "SendMeetingInvitations" it needs a "SendMeetingInvitationsOrCancellations"

http://msdn.microsoft.com/en-us/library/aa580254(v=exchg.140)

overriding calendar_item.rb update method and adding the custom attribute in the update_item class it works.

I need anyway to skip the serialization of these attributes while not communication with 2007+ MS Exchange server.

Is there a way to understand the server version? So i can skip serializing the attributes if < 2007

link82 avatar Jul 20 '12 09:07 link82

get_user_availability tests are failing I see, I also need to take a look at them later.

link82 avatar Jul 20 '12 09:07 link82

This seems to have stalled out, are there any updates on this? I ran into this issue today...

azurewraith avatar Apr 29 '13 20:04 azurewraith

Ah, I see @link82's fork and the changes he made. I'll fork this repo and add in the updates (since link's commits are kind of a mess) and see what comes out of it.

azurewraith avatar May 02 '13 05:05 azurewraith

@azurewraith it would be nice if you get this sorted out, so that I can merge this in.

ebeigarts avatar May 02 '13 07:05 ebeigarts

Sorry but it was my first fork. I started fixing it up locally but later the project I've been working on was suspend and i never completed the changes. I'm sorry about that. :(

link82 avatar May 02 '13 07:05 link82