从位于同一网络上另一台计算机上的电子邮件消息创建 pst 时未呈现消息

Messages not rendered when a pst is created from email messages located in another machine on a same network

我正在从位于同一网络上另一台机器上的消息文件创建一个 pst。但是当我加载 pst 时,不会呈现消息。我添加了一个屏幕截图。代码如下:

从我的本地计算机导入消息文件时不会出现问题。

     private static void GeneratePST(string [] messageFiles, string outputPstPath)
    {
        RDOSession pstSession = null;
        RDOPstStore store = null;
        RDOFolder folder = null;
        RDOMail rdo_Mail = null;
        RDOItems items = null;
        try
        {
            pstSession = new RDOSession();
            store = pstSession.LogonPstStore(outputPstPath, 1, Path.GetFileNameWithoutExtension(outputPstPath));
            folder = store.IPMRootFolder;
            folder = folder.Folders.Add("Loose Messages");
            foreach (string messages in messageFiles)
            {
                items = folder.Items;
                rdo_Mail = items.Add("IPM.NOTE");
                rdo_Mail.Import(messages, rdoSaveAsType.olMSG);
                rdo_Mail.Save();
            }
        }
        catch (Exception ex)
        {
            //log exception
        }
        finally
        {
            Marshal.ReleaseComObject(rdo_Mail);
            Marshal.ReleaseComObject(folder);
            Marshal.ReleaseComObject(store);
            Marshal.ReleaseComObject(items);
            pstSession.Logoff();
            Marshal.ReleaseComObject(pstSession);
            GC.Collect();
        }      
    }

我在导入消息文件之前也模拟过网络机器。但问题依然存在。

该问题只存在于另一台机器上的文件。消息是为位于我的机器中的 msg 文件呈现的。另外,我注意到问题仅与消息文件有关。呈现 EML 文件。所以,这可能不是模仿的问题。

请帮忙。

Microsoft 不支持访问网络驱动器上的 PST 文件。它们必须在本地计算机上。

此外,没有理由连续检索 RDOItems 对象 - 您永远不会释放旧值,因此这些对象会一直存在,直到您的应用程序退出。 rdo_Mail 对象同上:

        folder = folder.Folders.Add("Loose Messages");
        items = folder.Items;
        foreach (string messages in messageFiles)
        {
            if (rdo_Mail != null) Marshal.ReleaseComObject(rdo_Mail);
            rdo_Mail = items.Add("IPM.NOTE");
            rdo_Mail.Import(messages, rdoSaveAsType.olMSG);
            rdo_Mail.Save();
        }