RDOMail.SaveAs 有时在 UNC 上不起作用

RDOMail.SaveAs sometimes doesn't work over a UNC

我有一个使用 Redemption 库的 C# Outlook 加载项。

除其他外,此加载项将所选邮件复制到网络上的某个共享位置。

它通常运行良好,但有时,共享上的 .msg 文件似乎已损坏。尝试处理它的服务无法读取它。双击它会显示此消息:“无法读取项目”。

有时,我会看到一条错误消息:

SaveEmail - System.Runtime.InteropServices.COMException (0x8007000): Error in StgCreateDocFile: 0x8007000 at Redemption.IRDOMail.SaveAs(String Path, Object Type) at XYZNameSpace.Email.SaveEmail(...)

这里是将邮件保存到共享的代码:

// Save the mail in a temp local file first
mailItem.SaveAs(temppath, Outlook.OlSaveAsType.olMSG);
(... some processing ...)
// Reload the mail
RDOMail rm = rdoSession.GetMessageFromMsgFile(temppath);
// Save it again on a share
rm.SaveAs(filePathName, Outlook.OlSaveAsType.olMSG);

通常在 2 到 15 MB 之间。

非常感谢。

IStorage API 不太喜欢远程驱动器 - 存储共享功能无法工作。

第二次打开并保存消息确实没有多大意义 - 为什么不使用文件系统 API 简单地复制 MSG 文件?