Bob
Bob

Reputation: 11

EWS writing calendar event to user's calendar throws "The specified folder could not be found in the store."

I am attempting to create a meeting for a user with a room using the EWS api. When I send the below SOAP request, I receive the error "The specified folder could not be found in the store.". Is there anything wrong with the SOAP request, or is there anything that needs to be changed on the Exchange server?

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages">
  <SOAP-ENV:Header>
    <ns1:RequestServerVersion Version="Exchange2007"/>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns2:CreateItem SendMeetingInvitations="SendToAllAndSaveCopy">
      <ns2:SavedItemFolderId>
        <ns1:DistinguishedFolderId Id="calendar">
          <ns1:Mailbox>
            <ns1:EmailAddress>[[email protected]]</ns1:EmailAddress>
          </ns1:Mailbox>
        </ns1:DistinguishedFolderId>
      </ns2:SavedItemFolderId>
      <ns2:Items>
        <ns1:CalendarItem>
          <ns1:ItemClass>IPM.Appointment</ns1:ItemClass>
          <ns1:Subject>Test</ns1:Subject>
          <ns1:Sensitivity>Normal</ns1:Sensitivity>
          <ns1:Importance>Normal</ns1:Importance>
          <ns1:Start>2018-12-29T06:49:00+00:00</ns1:Start>
          <ns1:End>2018-12-29T06:50:00+00:00</ns1:End>
          <ns1:RequiredAttendees>
            <ns1:Attendee>
              <ns1:Mailbox>
                <ns1:Name>Test user</ns1:Name>
                <ns1:EmailAddress>[[email protected]]</ns1:EmailAddress>
                <ns1:RoutingType>SMTP</ns1:RoutingType>
              </ns1:Mailbox>
            </ns1:Attendee>
          </ns1:RequiredAttendees>
          <ns1:Resources>
            <ns1:Attendee>
              <ns1:Mailbox>
                <ns1:EmailAddress>[[email protected]]</ns1:EmailAddress>
                <ns1:RoutingType>SMTP</ns1:RoutingType>
              </ns1:Mailbox>
            </ns1:Attendee>
          </ns1:Resources>
        </ns1:CalendarItem>
      </ns2:Items>
    </ns2:CreateItem>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Upvotes: 1

Views: 408

Answers (1)

Glen Scales
Glen Scales

Reputation: 22032

That error indicates you don't have rights to the underlying calendar your trying to create the Appointment on. You would probably be better using EWS Impersonation in the senerio you describing as that will allows you to create the Appointment as the user (instead of On Behalf of) see https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-configure-impersonation

With you code you should be using Exchange2007

<SOAP-ENV:Header>
 <ns1:RequestServerVersion Version="Exchange2007"/>
</SOAP-ENV:Header>

the RTM version of Exchange had a different Id format so i would suggest at least Exchange2007_SP1 or use the version you have the code working against see https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/ews-schema-versions-in-exchange

Upvotes: 0

Related Questions