从电子邮件文件创建 pst 时,Redemption API 是否支持 unicode 字符?
Do Redemption API support unicode characters when creating pst from email message files?
我有一个正文中包含 unicode 字符的电子邮件文件。当我为该消息文件创建一个 pst 并将其加载到 outlook 中时,正文完全丢失了。
从电子邮件文件创建 pst 时,兑换 api 是否支持 unicode 字符?
更新 1
下面是创建PST的代码
private static void CreatePSTUsingRedemption(XmlNodeList nodelist, string pstPath)
{
RDOSession pstSession = null;
RDOPstStore store = null;
RDOFolder folder = null;
RDOMail rdo_Mail = null;
RDOItems items = null;
string processingFileId = string.Empty;
SafeMailItem sitem = new SafeMailItem();
try
{
pstSession = new RDOSession();
store = pstSession.LogonPstStore(pstPath, 1, Path.GetFileNameWithoutExtension(pstPath));
int completedCount = 0;
folder = store.IPMRootFolder;
RDOFolder inboxFolder = pstSession.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);
inboxFolder.Delete();
RDOFolder sentFolder = pstSession.GetDefaultFolder(rdoDefaultFolders.olFolderSentMail);
sentFolder.Delete();
RDOFolder outboxFolder = pstSession.GetDefaultFolder(rdoDefaultFolders.olFolderOutbox);
outboxFolder.Delete();
folder = folder.Folders.Add("Messages");
foreach (XmlNode node in nodelist)
{
processingFileId = node["Id"].InnerText;
RemoteSharedInfo rI = XmlUtil.GetObjectFromXmlString<RemoteSharedInfo>(node["RemoteSharedInfo"].OuterXml);
using (FileShareImpersonator imp = new FileShareImpersonator(rI))
{
imp.Start();
if (node["OriginalFileExtension"].InnerText.ToLower() == "eml" || node["OriginalFileExtension"].InnerText.ToLower() == "emlx")
{
items = folder.Items;
rdo_Mail = items.Add("IPM.Note");
sitem.Item = items.Add(0);
sitem.Import(node["FullPath"].InnerText, 0x400);
sitem.CopyTo(rdo_Mail);
rdo_Mail.Save();
store.Save();
completedCount++;
Console.WriteLine("FILES_PROCESSED:" + completedCount);
}
else //go to this ELSE block for email message files i.e for msg extension
{
rdo_Mail = pstSession.GetMessageFromMsgFile(node["FullPath"].InnerText);
rdo_Mail.CopyTo(folder);
rdo_Mail.Save();
store.Save();
completedCount++;
Console.WriteLine("FILES_PROCESSED:" + completedCount);
}
}
}
}
catch (Exception ex)
{
Console.Error.WriteLine("Error:" + ex.Message);
Environment.ExitCode = 1;
}
finally
{
Marshal.ReleaseComObject(rdo_Mail);
Marshal.ReleaseComObject(folder);
Marshal.ReleaseComObject(store);
Marshal.ReleaseComObject(sitem);
if (items != null)
Marshal.ReleaseComObject(items);
}
pstSession.Logoff();
Marshal.ReleaseComObject(pstSession);
GC.Collect();
Environment.ExitCode = 1;
}
是的,Redemption 完全启用了 Unicode。确保您创建的是 Unicode PST 文件。
创建 PST 文件的代码是什么? Outlook 的确切版本是什么?
我有一个正文中包含 unicode 字符的电子邮件文件。当我为该消息文件创建一个 pst 并将其加载到 outlook 中时,正文完全丢失了。 从电子邮件文件创建 pst 时,兑换 api 是否支持 unicode 字符?
更新 1
下面是创建PST的代码
private static void CreatePSTUsingRedemption(XmlNodeList nodelist, string pstPath)
{
RDOSession pstSession = null;
RDOPstStore store = null;
RDOFolder folder = null;
RDOMail rdo_Mail = null;
RDOItems items = null;
string processingFileId = string.Empty;
SafeMailItem sitem = new SafeMailItem();
try
{
pstSession = new RDOSession();
store = pstSession.LogonPstStore(pstPath, 1, Path.GetFileNameWithoutExtension(pstPath));
int completedCount = 0;
folder = store.IPMRootFolder;
RDOFolder inboxFolder = pstSession.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);
inboxFolder.Delete();
RDOFolder sentFolder = pstSession.GetDefaultFolder(rdoDefaultFolders.olFolderSentMail);
sentFolder.Delete();
RDOFolder outboxFolder = pstSession.GetDefaultFolder(rdoDefaultFolders.olFolderOutbox);
outboxFolder.Delete();
folder = folder.Folders.Add("Messages");
foreach (XmlNode node in nodelist)
{
processingFileId = node["Id"].InnerText;
RemoteSharedInfo rI = XmlUtil.GetObjectFromXmlString<RemoteSharedInfo>(node["RemoteSharedInfo"].OuterXml);
using (FileShareImpersonator imp = new FileShareImpersonator(rI))
{
imp.Start();
if (node["OriginalFileExtension"].InnerText.ToLower() == "eml" || node["OriginalFileExtension"].InnerText.ToLower() == "emlx")
{
items = folder.Items;
rdo_Mail = items.Add("IPM.Note");
sitem.Item = items.Add(0);
sitem.Import(node["FullPath"].InnerText, 0x400);
sitem.CopyTo(rdo_Mail);
rdo_Mail.Save();
store.Save();
completedCount++;
Console.WriteLine("FILES_PROCESSED:" + completedCount);
}
else //go to this ELSE block for email message files i.e for msg extension
{
rdo_Mail = pstSession.GetMessageFromMsgFile(node["FullPath"].InnerText);
rdo_Mail.CopyTo(folder);
rdo_Mail.Save();
store.Save();
completedCount++;
Console.WriteLine("FILES_PROCESSED:" + completedCount);
}
}
}
}
catch (Exception ex)
{
Console.Error.WriteLine("Error:" + ex.Message);
Environment.ExitCode = 1;
}
finally
{
Marshal.ReleaseComObject(rdo_Mail);
Marshal.ReleaseComObject(folder);
Marshal.ReleaseComObject(store);
Marshal.ReleaseComObject(sitem);
if (items != null)
Marshal.ReleaseComObject(items);
}
pstSession.Logoff();
Marshal.ReleaseComObject(pstSession);
GC.Collect();
Environment.ExitCode = 1;
}
是的,Redemption 完全启用了 Unicode。确保您创建的是 Unicode PST 文件。
创建 PST 文件的代码是什么? Outlook 的确切版本是什么?