I'm trying to access the calendar of other users via:
account = Account(
primary_smtp_address=user,
autodiscover=False,
config=config,
access_type=DELEGATE
)
items = account.calendar.filter(start__range=(start_date, end_date))
However, I'm getting Access is denied. Check credentials and try again., Cannot query rows in a table.
I am able to access their calendars via UI so I'm not sure if permissions is exactly the problem here (their calendar is public within the organization) and I am also already able to query my own calendar just fine, it's just when it comes to other users that I run into this. Any ideas?
Edit 1: this is the failing XML call:
Response data: <?xml version='1.0' encoding='utf-8'?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo
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" MajorVersion="15" MinorVersion="20" MajorBuildNumber="3305" MinorBuildNumber="32" Version="V2018_01_08"/>
</s:Header>
<s:Body>
<m:FindItemResponse
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:FindItemResponseMessage ResponseClass="Error">
<m:MessageText>Access is denied. Check credentials and try again., Cannot query rows in a table.</m:MessageText>
<m:ResponseCode>ErrorAccessDenied</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
</m:FindItemResponseMessage>
</m:ResponseMessages>
</m:FindItemResponse>
</s:Body>
</s:Envelope>
Also, unsure how helpful but, account.calendar.filter(start__range=(start_date, end_date))
returns just
QuerySet(q=start >= EWSDateTime(2020, 8, 26, 12, 18, 40, 194001, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>) AND start <= EWSDateTime(2020, 8, 28, 0, 0, tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>), folders=[Calendar (Calendar)])
Request XML:
<?xml version='1.0' encoding='utf-8'?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<s:Header>
<t:RequestServerVersion Version="Exchange2016"/>
<t:TimeZoneContext>
<t:TimeZoneDefinition Id="GMT Standard Time"/>
</t:TimeZoneContext>
</s:Header>
<s:Body>
<m:FindItem Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
</m:ItemShape>
<m:IndexedPageItemView MaxEntriesReturned="100" Offset="0" BasePoint="Beginning"/>
<m:Restriction>
<t:And>
<t:IsGreaterThanOrEqualTo>
<t:FieldURI FieldURI="calendar:Start"/>
<t:FieldURIOrConstant>
<t:Constant Value="2020-08-27T09:22:23+01:00"/>
</t:FieldURIOrConstant>
</t:IsGreaterThanOrEqualTo>
<t:IsLessThanOrEqualTo>
<t:FieldURI FieldURI="calendar:Start"/>
<t:FieldURIOrConstant>
<t:Constant Value="2020-08-28T00:00:00+01:00"/>
</t:FieldURIOrConstant>
</t:IsLessThanOrEqualTo>
</t:And>
</m:Restriction>
<m:ParentFolderIds>
<t:DistinguishedFolderId Id="calendar">
<t:Mailbox>
<t:EmailAddress>censored@company.com</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
</t:DistinguishedFolderId>
</m:ParentFolderIds>
</m:FindItem>
</s:Body>
</s:Envelope>