Share via

Oauth pullsubscription on public folder problem

john in t veld 0 Reputation points
2022-08-26T16:15:20.707+00:00

Hi,
I am in the process of supporting Oauth in my EWS app but i'm stuck on getting events from a pullsubscription.

There's no issue for mailbox folders, only public folders.

The only change in the code is that the exchange service now has Oauthcredentials and impersonates an email address that has owner permissions on the public folder .
When using basic authentication the exchange service credentials are that of a "service account" email address and it does not use impersonation to get a pullsubscribtion on the public folder.

I'm not getting errors when setting the pullsubscription, and I can check that it has an ID, so it is there. However when I issue the getevents method (after adding some items to the folder) nothing fires.

this is the trace of the getevents (i made sure there were events in the folder)

26-8-2022 17:56:31 : EwsRequestHttpHeaders --- <Trace Tag="EwsRequestHttpHeaders" Tid="1" Time="2022-08-26 15:56:31Z">  
POST /EWS/Exchange.asmx HTTP/1.1  
Content-Type: text/xml; charset=utf-8  
Accept: text/xml  
User-Agent:   
ExchangeServicesClient/15.00.0913.015  
  
Accept-Encoding: gzip,deflate  
X-AnchorMailbox: ******@domainname.onmicrosoft.com  
  
X-PublicFolderMailbox: ******@domainname.onmicrosoft.com  
  
X-PreferServerAffinity: True  
  
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IkRPRTZVMFJHdnM0X3FHanBhbU9KTjM1VHVsdmNRWUtjNHlFVDk2YnhfQjgiLCJhbGciOiJSUzI1NiIsIng1dCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSIsImtpZCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSJ9.eyJhdWQiOiJodHRwczovL291dGxvb2sub2ZmaWNlMzY1LmNvbSIsImlzcyI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0L2VkMDc0NDQxLWI4MjUtNDJjYy04ODU2LTE3YWUzYjBiMmY0Mi8iLCJpYXQiOjE2NjE1Mjg5NjcsIm5iZiI6MTY2MTUyODk2NywiZXhwIjoxNjYxNTMyODY3LCJhaW8iOiJFMlpnWUxpVHNzZktUS2x6bGtGdzNoS3Z5WmIy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shdI8--F9yyqhJ44Oh90Ha9xw  
  
  
</Trace>  
  
26-8-2022 17:56:31 : EwsRequest --- <Trace Tag="EwsRequest" Tid="1" Time="2022-08-26 15:56:31Z" Version="15.00.0913.015">  
  <?xml version="1.0" encoding="utf-8"?>  
  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">  
    <soap:Header>  
      <t:RequestServerVersion Version="Exchange2013" />  
      <t:ExchangeImpersonation>  
        <t:ConnectingSID>  
          <t:SmtpAddress>******@domainname.com</t:SmtpAddress>  
        </t:ConnectingSID>  
      </t:ExchangeImpersonation>  
    </soap:Header>  
    <soap:Body>  
      <m:GetEvents>  
        <m:SubscriptionId>JwBhczhwcjA3bWI3OTI1LmV1cnByZDA3LnByb2Qub3V0bG9vay5jb20QAAAAS114Ai9w+UayiTSZLtc6DY6SxEJ7h9oIEAAAAAAAAAAAAAAAAAAAAAAAAAA=</m:SubscriptionId>  
        <m:Watermark>AQAAABTg+YC4KZFNttW01ElEHaecAgsrAAAAAAA=</m:Watermark>  
      </m:GetEvents>  
    </soap:Body>  
  </soap:Envelope>  
</Trace>  
  
26-8-2022 17:56:31 : EwsResponseHttpHeaders --- <Trace Tag="EwsResponseHttpHeaders" Tid="1" Time="2022-08-26 15:56:31Z">  
HTTP/1.1 200 OK  
Transfer-Encoding: chunked  
request-id: de8811fe-8069-c2ff-15a7-5ac62e39d3f5  
Alt-Svc: h3=":443",h3-29=":443"  
X-CalculatedFETarget: AM6PR01CU002.internal.outlook.com  
X-BackEndHttpStatus: 200,200  
X-CalculatedBETarget: AS8PR07MB7925.eurprd07.PROD.OUTLOOK.COM  
X-RUM-Validated: 1  
x-ms-appId: fdea1aff-feaa-4d04-b795-55d873f2283b  
Restrict-Access-Confirm: 1  
x-EwsHandler: GetEvents  
X-BeSku: WCS6  
X-DiagInfo: AS8PR07MB7925  
X-BEServer: AS8PR07MB7925  
X-Proxy-RoutingCorrectness: 1  
X-Proxy-BackendServerStatus: 200  
X-FEProxyInfo: AM0PR02CA0136.EURPRD02.PROD.OUTLOOK.COM  
X-FEEFZInfo: AMS  
X-FEServer: AM6PR01CA0042,AM0PR02CA0136  
X-FirstHopCafeEFZ: AMS  
Cache-Control: private  
Content-Type: text/xml; charset=utf-8  
Date: Fri, 26 Aug 2022 15:56:28 GMT  
Set-Cookie: exchangecookie=52d38d4eb5c14276b165655c6cd18691; path=/; secure  
Server: Microsoft-IIS/10.0  
X-AspNet-Version: 4.0.30319  
X-Powered-By: ASP.NET  
  
  
</Trace>  
  
26-8-2022 17:56:31 : EwsResponse --- <Trace Tag="EwsResponse" Tid="1" Time="2022-08-26 15:56:31Z" Version="15.00.0913.015">  
  <?xml version="1.0" encoding="utf-8"?>  
  <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">  
    <s:Header>  
      <h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="5588" MinorBuildNumber="3" Version="V2018_01_08" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />  
    </s:Header>  
    <s:Body>  
      <m:GetEventsResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">  
        <m:ResponseMessages>  
          <m:GetEventsResponseMessage ResponseClass="Success">  
            <m:ResponseCode>NoError</m:ResponseCode>  
            <m:Notification>  
              <t:SubscriptionId>JwBhczhwcjA3bWI3OTI1LmV1cnByZDA3LnByb2Qub3V0bG9vay5jb20QAAAAS114Ai9w+UayiTSZLtc6DY6SxEJ7h9oIEAAAAAAAAAAAAAAAAAAAAAAAAAA=</t:SubscriptionId>  
              <t:PreviousWatermark>AQAAABTg+YC4KZFNttW01ElEHaecAgsrAAAAAAA=</t:PreviousWatermark>  
              <t:MoreEvents>false</t:MoreEvents>  
              <t:StatusEvent>  
                <t:Watermark>AQAAABTg+YC4KZFNttW01ElEHaf4BQsrAAAAAAE=</t:Watermark>  
              </t:StatusEvent>  
            </m:Notification>  
          </m:GetEventsResponseMessage>  
        </m:ResponseMessages>  
      </m:GetEventsResponse>  
    </s:Body>  
  </s:Envelope>  
</Trace>  

@Glen Scales

Exchange | Exchange Server | Development
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.