简体   繁体   English

Outlook 加载项 - 附件 ID 在桌面应用程序中无法正常工作,但在 Web 应用程序中可以正常工作

[英]Outlook add-in - attachment ID's not working correctly in desktop app, but work on web app

I've developed an add-in for Outlook, it needs to be able to access attachments to emails.我为 Outlook 开发了一个插件,它需要能够访问电子邮件的附件。

On the desktop app, if I move an email with attachments from a shared folder to my main inbox, then try to run the add-in on it, i get the error:在桌面应用程序上,如果我将带有附件的电子邮件从共享文件夹移动到我的主收件箱,然后尝试在其上运行加载项,我会收到错误消息:

The specified attachment Id is invalid.

However, if I perform exactly the same operation through the web app, it works fine.但是,如果我通过网络应用程序执行完全相同的操作,它就可以正常工作。

I have checked and the Office.context.mailbox.item.itemId and Office.context.mailbox.item.attachments[i].id are exactly the same whether on web or desktop.我已经检查过, Office.context.mailbox.item.itemIdOffice.context.mailbox.item.attachments[i].id无论是在网络上还是桌面上都完全相同。

Emails with attachments that have not been moved from a different folder, and emails without attachments work fine.带有未从不同文件夹移动的附件的电子邮件和没有附件的电子邮件都可以正常工作。

I am fetching the attachment on a remote server through a PHP script, using a callback token I orginally get from Office.context.mailbox.getCallbackTokenAsync .我正在通过 PHP 脚本获取远程服务器上的附件,使用我最初从Office.context.mailbox.getCallbackTokenAsync获得的回调令牌。 The requests are made via EWS requests.这些请求是通过 EWS 请求发出的。

I am running Office 365 and the Outlook version is 1910 (Build 12130.20390), running on Windows 10.我正在运行 Office 365,Outlook 版本是 1910(内部版本 12130.20390),在 Windows 10 上运行。

Can somebody please help?有人可以帮忙吗?

After some helpful suggestions from @OutlookAdd-insTeam-MSFT, I've come to a solution for this.在@OutlookAdd-insTeam-MSFT 提出一些有用的建议后,我找到了解决方案。

The problem is, after moving a message from a shared folder to the main inbox, when using the desktop app, the Office.context.mailbox.item.attachments (created when we run Office.initialize ) no longer returns the correct ID's, instead it seems to return the old cached/out of date ID's from before the email was moved.问题是,在将消息从共享文件夹移动到主收件箱后,使用桌面应用程序时, Office.context.mailbox.item.attachments (在我们运行Office.initialize时创建)不再返回正确的 ID,而是它似乎返回了电子邮件移动之前的旧缓存/过时 ID。 The ID's returned when using the web app are correct using this method.使用此方法时,使用 Web 应用程序时返回的 ID 是正确的。

However, requesting the ID's from the exchange server, via an EWS request (or a REST call, but I use EWS) always returns the correct attachment ID's, whether called from the web app or the desktop app.但是,通过 EWS 请求(或 REST 调用,但我使用 EWS)从交换服务器请求 ID 始终返回正确的附件 ID,无论是从 Web 应用程序还是桌面应用程序调用。

So, the solution I have come to is to make sure and request all of the attachment ID's from the exchange server, rather than using the Office.context.mailbox.item object.因此,我得出的解决方案是确保并从交换服务器请求所有附件 ID,而不是使用Office.context.mailbox.item对象。 It means adding in an extra step of having to get a callback token first to then be able to request the info from the exchange server, but it means you always get the correct ID's.这意味着要添加一个额外的步骤,即必须先获取回调令牌,然后才能从交换服务器请求信息,但这意味着您始终可以获得正确的 ID。

I hope this is of help to someone else.我希望这对其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Outlook 加载项:web 和 Windows 桌面应用程序的 UI 不同 - Outlook Add-In: The UI is different for web and Windows Desktop app 桌面和Web Outlook加载项 - Add-in for desktop and web Outlook Outlook 加载项 cookie 在桌面应用程序中清除,但为什么 localStorage 有效? - Outlook Add-in cookies cleared in desktop app, but why localStorage works? Microsoft Outlook 网页版和桌面版 + 插件 - Microsoft Outlook Web & Desktop + Add-in 加载项在 Outlook Web 应用程序在经典模式下在 Safari 中加载时不起作用 - Add-in not working in Outlook Web App in classic mode when loaded in Safari 将 Windows 凭证传递给 IIS web 应用程序从 Z038E648F69B23B2A59DAF262D8122A2 - Passthrough Windows credentials to IIS web app from Outlook add-in Outlook Web 加载项:2020 年 10 月 Mac 更新后附件 ID 格式错误 - Outlook web add-in: attachment id is malformed after Oct 2020 Mac update 是否有任何平台/ Office商店可以发布COM Outlook加载项(桌面应用程序版本) - Is there any platform/Office store to publish COM outlook Add-in (Desktop App Version) 仅Outlook桌面上的Web加载项加载问题 - web add-in load issues on Outlook desktop only 调试桌面 Outlook 插件 - Debugging desktop Outlook Add-in
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM