Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full calendar item update support #222

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gshutler
Copy link
Member

CalendarItem#update_item! did not support the full range of options available via the EwsBuilder#build_xml! method as :text was the only reserved attribute preserved and a nested structure was not supported at all.

This commit makes :sub_elements and :xmlns_attribute reserved too and ensures that any nested structures are also escaped as necessary.

CalendarItem#update_item! did not support the full range of options
available via the EwsBuilder#build_xml! method as :text was the only
reserved attribute preserved and a nested structure was not supported at
all.

This commit makes :sub_elements and :xmlns_attribute reserved too and
ensures that any nested structures are also escaped as necessary.
@gshutler
Copy link
Member Author

I think I have a %i{} in here, didn't realise tests ran against 1.9.3, will fix.

@GeorgeDewar
Copy link

Hi @gshutler, I've been trying to using update_item! to update attendees on a meeting. It looked like this PR might be adding the required support, but I still have not been able to get it to work with your code.

I'm calling it like:

new_attendee = [{:name=>{:text=>"General User"}},
                        {:email_address=>{:text=>"myemail@mydomain.com"}},
                        {:routing_type=>{:text=>"SMTP"}},
                        {:mailbox_type=>{:text=>"Mailbox"}}]
@calendar_item.update_item!(
  updates: { required_attendees: new_attendee },
  send_meeting_invitations_or_cancellations: "SendToAllAndSaveCopy",
)

The Updates section of the request ends up looking like:

<t:Updates>
    <t:SetItemField>
      <t:FieldURI FieldURI="calendar:RequiredAttendees"/>
      <CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
        <RequiredAttendees>[{"Name"=&gt;{:text=&gt;"General User"}}, {"EmailAddress"=&gt;{:text=&gt;"myemail@mydomain.com"}}, {"RoutingType"=&gt;{:text=&gt;"SMTP"}}, {"MailboxType"=&gt;{:text=&gt;"Mailbox"}}]</RequiredAttendees>
      </CalendarItem>
    </t:SetItemField>
  </t:Updates>

Note the XML-encoded JSON, rather than the nested XML structure expected.

Would you have any tips? Thanks!

Base automatically changed from master to main February 3, 2021 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants