none
Impersonating user with Soap calls RRS feed

  • Question

  • I want to create (and delete) calendar items in Outlook 2007 (and Exchange 2007).

    I do this with soap calls in SOAP UI 5.0.0.

    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types">
       <soap:Header>
          <typ:RequestServerVersion Version="Exchange2010_SP2"/>
          <typ:ExchangeImpersonation>
             <typ:ConnectingSID>  
                <!--<typ:PrincipalName>x@y.com</typ:PrincipalName>--> 
                <typ:SmtpAddress>x@y.com</typ:SmtpAddress>
             </typ:ConnectingSID>
          </typ:ExchangeImpersonation>
      </soap:Header>
      <soap:Body>
        <CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
                    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
                    SendMeetingInvitations="SendToAllAndSaveCopy" >
          <SavedItemFolderId>
            <t:DistinguishedFolderId Id="calendar"/>
          </SavedItemFolderId>
          <Items>
            <t:CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
              <Subject>Planning Meeting - 1234</Subject>
              <Body BodyType="Text">1234 - Plan the agenda for next week's meeting.</Body>
              <ReminderIsSet>true</ReminderIsSet>
              <ReminderMinutesBeforeStart>60</ReminderMinutesBeforeStart>
              <Start>2014-07-22T14:00:00</Start>
              <End>2014-07-23T15:00:00</End>
              <IsAllDayEvent>false</IsAllDayEvent>
              <LegacyFreeBusyStatus>Busy</LegacyFreeBusyStatus>
              <Location>Conference Room 721</Location>
            </t:CalendarItem>
          </Items>
        </CreateItem>
      </soap:Body>
    </soap:Envelope>
    

    I created an event in my own calendar (without the typ:ExchangeImpersonation part).

    So now I want to create an event in an other user's calendar.

    I have an admin account, who got al rights to do this. 

    But when I configure my endpoint and Authorization (NTLM) to the admins credentials, I get this as response:

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
       <s:Body>
          <s:Fault>
             <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorImpersonateUserDenied</faultcode>
             <faultstring xml:lang="nl-BE">The account does not have permission to impersonate the requested user.</faultstring>
             <detail>
                <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorImpersonateUserDenied</e:ResponseCode>
                <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The account does not have permission to impersonate the requested user.</e:Message>
             </detail>
          </s:Fault>
       </s:Body>
    </s:Envelope>

    Admin got all the rigths to do this (normally).

    So how can I create an event in another users calendar, with SOAP calls?

    Is this with the use of typ:ExchangeImpersonation ?

    TY

    Wednesday, July 23, 2014 9:30 AM

Answers

  • Fixed

    For anyone who wants to know:

    <SavedItemFolderId>
        <t:DistinguishedFolderId Id="calendar">
         <t:Mailbox> 
            <t:EmailAddress>x@y.com</t:EmailAddress> 
         </t:Mailbox> 
       </t:DistinguishedFolderId>
    </SavedItemFolderId>

    And login with admin credentials.

    see

    http://blogs.msdn.com/b/mstehle/archive/2009/06/16/exchange-api-team-blog-exchange-impersonation-vs-delegate-access.aspx

    Wednesday, July 23, 2014 10:09 AM