问题描述
我正在尝试通过以下方式访问其他用户的日历:
account = Account(
primary_smtp_address=user,autodiscover=False,config=config,access_type=DELEGATE
)
items = account.calendar.filter(start__range=(start_date,end_date))
但是,我可以通过用户界面访问Access is denied. Check credentials and try again.,Cannot query rows in a table.
,因此我不确定权限是否正是这里的问题(他们的日历在组织内是公开的),而且我也已经能够查询我自己的日历就好了,只是遇到其他用户的时候。有什么想法吗?
编辑1:这是失败的XML调用:
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>
此外,不确定account.calendar.filter(start__range=(start_date,end_date))
的返回效果如何
QuerySet(q=start >= EWSDateTime(2020,8,26,12,18,40,194001,tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>) AND start <= EWSDateTime(2020,28,tzinfo=<DstTzInfo 'Europe/London' BST+1:00:00 DST>),folders=[Calendar (Calendar)])
请求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>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)