tessr
tessr

Reputation: 628

How can I access the meeting request for a calendar event through Exchange Web Services? (and PHP and SOAP)

Is there a way to access (and modify) MeetingRequests through Exchange Web Services? Particularly through PHP and SOAP.

When I tried to explicitly create a MeetingRequest with CreateItem I got an error saying that a MeetingRequest was an invalid type for CreateItem and that MeetingRequests are created automatically when CalendarItems with appropriate MessageDispositions are created. However, creating a CalendarItem and NOT sending it, and then using GetItem to retrieve details didn't yield a meeting request (i.e., it didn't exist yet).

As far as I can tell, MeetingRequests are created and sent at the same time, and there's no way to edit them in between. I'm hoping I'm wrong. Am I wrong?

Ultimately, I'm trying to add attachments to meeting requests. Right now I can add attachments to the meeting, but not to the request (i.e., when the meeting is opened in Calendar the attachment opens fine; when the meeting request is received (in the inbox) the attachment cannot be opened).

Upvotes: 2

Views: 925

Answers (1)

Henning Krause
Henning Krause

Reputation: 5422

Yes, this is possible.

First, create the appointment:

      <m:CreateItem SendMeetingInvitations="SendToNone">
    <m:SavedItemFolderId>
      <t:DistinguishedFolderId Id="calendar" />
    </m:SavedItemFolderId>
    <m:Items>
      <t:CalendarItem>
        <t:Subject>testsubject</t:Subject>
        <t:Body BodyType="Text">testbody</t:Body>
        <t:Start>2011-07-24T09:36:58+02:00</t:Start>
        <t:End>2011-07-24T10:36:58+02:00</t:End>
      </t:CalendarItem>
    </m:Items>
  </m:CreateItem>

Then, append the attachments to the appointment:

      <m:CreateAttachment>
    <m:ParentItemId Id="itemid" />
    <m:Attachments>
      <t:FileAttachment>
        <t:Name>test.pdf</t:Name>
        <t:IsInline>false</t:IsInline>
        <t:IsContactPhoto>false</t:IsContactPhoto>
        <t:Content>base64 encoded content here</t:Content>
      </t:FileAttachment>
    </m:Attachments>
  </m:CreateAttachment>

And finally, add recipients and update the meeting.

      <m:UpdateItem ConflictResolution="AutoResolve" SendMeetingInvitationsOrCancellations="SendToAllAndSaveCopy">
    <m:ItemChanges>
      <t:ItemChange>
        <t:ItemId Id="itemid of the original item" ChangeKey="changekey" />
        <t:Updates>
          <t:SetItemField>
            <t:FieldURI FieldURI="calendar:RequiredAttendees" />
            <t:CalendarItem>
              <t:RequiredAttendees>
                <t:Attendee>
                  <t:Mailbox>
                    <t:Name>Someone</t:Name>
                    <t:EmailAddress>mailaddress</t:EmailAddress>
                  </t:Mailbox>
                </t:Attendee>
              </t:RequiredAttendees>
            </t:CalendarItem>
          </t:SetItemField>
        </t:Updates>
      </t:ItemChange>
    </m:ItemChanges>
  </m:UpdateItem>

This will add the attachment to the invitation message.

Upvotes: 4

Related Questions