Outlook 当我尝试按ID检索附件时,我得到一个ErrorItemNotFound响应

Outlook 当我尝试按ID检索附件时,我得到一个ErrorItemNotFound响应,outlook,python-requests,exchangewebservices,outlook-addin,Outlook,Python Requests,Exchangewebservices,Outlook Addin,我的问题似乎是权限错误。当我尝试使用EWS Soap请求按ID检索附件时,我得到一个ErrorItemNotFound响应 因此,我大致遵循了Microsoft的GetAttachment示例-- 接收EWS令牌、EWS URL和附件ID的Web服务是用Python编写的 这是我的工作 我有一个用Javascript编写的Outlook加载项,用于响应邮件项目选择 我使用isRest=false选项检索EWS令牌,然后 Office.context.mailbox.getCallbackToke

我的问题似乎是权限错误。当我尝试使用EWS Soap请求按ID检索附件时,我得到一个ErrorItemNotFound响应

因此,我大致遵循了Microsoft的GetAttachment示例--

接收EWS令牌、EWS URL和附件ID的Web服务是用Python编写的

这是我的工作

我有一个用Javascript编写的Outlook加载项,用于响应邮件项目选择

我使用isRest=false选项检索EWS令牌,然后

Office.context.mailbox.getCallbackTokenAsync(getEWSCallback,
options);
对于有附件的邮件,我提取有关附件的信息,包括附件Id

以下是附件信息的示例:

{

"id": 
"XZkADdlMDAxOTFiLWZmMWYtNGI1Ni1iYmM2LTlhOTJjYTBmMTI1MQBGAAAAAAAO1b910PexQpLkqgde51DABwAyR2+p4hG4RbXOV7pJuYtiAAAAAAEMAAAyR2+p4hG4RbXOV7pJuYtiAABsXaGoAAABEgAQAJ8Lans/ZeZLrkpk6mQ/QQg=",

"name": 
"xxxxxxxxxxx.docx",

"contentType": 
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",

"size": 
162008,

"attachmentType": 
0,

"isInline": 
false

}
我将EWS令牌、EWS Url和附件信息传递给我的Web服务;这是用Python编写的

My WebService构造soap请求:

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"

xmlns:xsd="https://www.w3.org/2001/XMLSchema"

xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">

<soap:Header>

<t:RequestServerVersion Version="Exchange2013" />

</soap:Header>

  <soap:Body>

    <GetAttachment xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"

    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">

      <AttachmentShape/>

      <AttachmentIds>

        <t:AttachmentId Id="XZkADdlMDAxOTFiLWZmMWYtNGI1Ni1iYmM2LTlhOTJjYTBmMTI1MQBGAAAAAAAO1b910PexQpLkqgde51DABwAyR2+p4hG4RbXOV7pJuYtiAAAAAAEMAAAyR2+p4hG4RbXOV7pJuYtiAABsXaGoAAABEgAQAJ8Lans/ZeZLrkpk6mQ/QQg="/>

      </AttachmentIds>

    </GetAttachment>

  </soap:Body>

</soap:Envelope>
我得到的答复如下:

<?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="2430"
MinorBuildNumber="27"
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:GetAttachmentResponse
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:GetAttachmentResponseMessage
ResponseClass="Error">

<m:MessageText>The specified object was not found in the store., The process failed to get the correct properties.</m:MessageText>

<m:ResponseCode>ErrorItemNotFound</m:ResponseCode>

<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>

<m:Attachments/>

</m:GetAttachmentResponseMessage>

</m:ResponseMessages>

</m:GetAttachmentResponse>

</s:Body>

</s:Envelope>

在存储中找不到指定的对象。进程无法获取正确的属性。
ErrorItemNotFound
0
我的理解是ErrorItemNotFound响应表示(1)该项不存在或(2)我没有访问该项的权限

如果我使用损坏的EWS令牌,我会收到一个Http 401错误,表明我没有授权发布EWS。因此,我相信承载身份验证工作正常

有什么想法或帮助吗

<?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="2430"
MinorBuildNumber="27"
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:GetAttachmentResponse
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:GetAttachmentResponseMessage
ResponseClass="Error">

<m:MessageText>The specified object was not found in the store., The process failed to get the correct properties.</m:MessageText>

<m:ResponseCode>ErrorItemNotFound</m:ResponseCode>

<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>

<m:Attachments/>

</m:GetAttachmentResponseMessage>

</m:ResponseMessages>

</m:GetAttachmentResponse>

</s:Body>

</s:Envelope>