Outlook ReportItem.Body返回一些用户混乱的编码 [英] Outlook ReportItem.Body returning messed up encoding for some users

查看:370
本文介绍了Outlook ReportItem.Body返回一些用户混乱的编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果某些用户自动化Outlook客户端以查看共享收件箱中的反弹/报告项目,那么Outlook最近有一个奇怪的问题,而不是返回消息的清晰文本,如文档所示,我们返回一个已被解析为UTF-8字符串的Unicode字符串,因此它看起来像中文。



现在我可以用一些代码过去,但另外一个问题是这个变化发生在outlook以及所有访问该收件箱的用户。在Outlook中看到的消息本身就是汉字 - 原始的unicode html解析为UTF-8。



看起来这可能是一个已知的问题,但是我想看看我是否可以在这里得到一些建议。



我们正在使用常规方法访问报告项目:

 对于Counter为Integer = Inbox.Items.Count为1步-1 
Dim报表为Outlook.ReportItem = Inbox.Items(Counter)
Dim Body As String = Report.Body

最后一行是我们获得加油文字的地方。在VBA中,它尝试以ASCII解析,并返回一个大块?而在.Net它返回的值被解析为UTF-8,我们得到显示中文的字符。在任一情况下,收件箱中的原始报告项目都将以中文字符显示,并继续为该收件箱的所有用户执行此操作。



任何想法?



更新:我想分享一个更新,因为它似乎有几个人仍然看到它。



我想快速强调编码问题在这里很好地讨论,并且通过代码访问消息的正文文本被覆盖并且相当容易。 但是,编码问题在Outlook客户端中仍然存在,并且从未解决,而且这个问题是我的问题。必须在 .Body 属性中存在一些错误,该错误会纠正Exchange服务器上原始邮件对象的编码。祝好运,任何需要解决这个问题的人。



更新:一个答案和更详细的问题描述如下,并作为答案选择。

解决方案

是的,Outlook对象模型中的ReportItem.Body属性有问题(在Outlook 2013 abd 2016中存在)您可以在 OutlookSpy 中看到它:选择NDR消息,单击项目按钮,选择主体属性 - 它会乱码更糟糕的是,一旦报告项目被OOM触及,Outlook将在预览窗格中显示相同的垃圾。



报告文本存储在各种MAPI收件人属性中在OutlookSpy中单击IMessage按钮并转到GetRecipientTable选项卡)。问题是ReportItem对象不会公开收件人集合。解决方法是使用扩展MAPI(C ++或Delphi)或赎回(任何语言) - 其 ReportItem .ReportText属性没有此问题:

  set oItem = Application.ActiveExplorer.Selection(1)
set oSession = CreateObject(Redemption.RDOSession)
oSession.MAPIOBJECT = Application.Session .MAPIOBJECT
set rItem = oSession.GetRDOObjectFromOutlookObject(oItem)
MsgBox rItem.ReportText


We have a weird issue with Outlook lately that is impacting some users.

If certain users automate the Outlook Client to view bounce backs/ReportItems in a shared inbox, rather than returning the clear text of the message as indicated by the documentation we get back a unicode string that has been parsed as a UTF-8 string - so it looks like Chinese.

Now I can get past that with some code, but the additional issue is that this change occurs in outlook as well for all users with access to that inbox. The message itself as viewed in outlook appears as Chinese characters - the original unicode html parsed as UTF-8.

It seems like this might be a known issue, but I wanted to see if I could get some advice here.

We are using the normal methods to access the report item:

For Counter as Integer = Inbox.Items.Count To 1 Step -1
    Dim Report As Outlook.ReportItem = Inbox.Items(Counter)
    Dim Body As String = Report.Body

The last line is where we get the garbaled text. In VBA it attempts to parse it as ASCII and returns a large block of "?" while in .Net it returns the value parsed as UTF-8 and we get the characters that appear Chinese. In either case the original report item in the inbox begins displaying as Chinese characters and continues to do so for all users of that inbox.

Any ideas?

UPDATE: I wanted to share an update on this since it seems like a few people are still seeing it.

I want to quickly emphasize that the encoding issue is discussed well here and that accessing the body text of the message via code is covered and fairly easy. However, the encoding issue continues to exist in the Outlook client and was never resolved, and this issue was my going concern. There must be some bug in the .Body property which buggers up the encoding on the original message object on the Exchange server. Good luck to anyone who needs to resolve that particular issue.

UPDATE AGAIN: An answer and a more detailed description of the issue is posted below and selected as the answer.

解决方案

Yes, there is a problem with ReportItem.Body property in the Outlook Object Model (present in Outlook 2013 abd 2016) - you can see it in OutlookSpy: select an NDR message, click Item button, select the Body property - it will be garbled. Worse than that, once the report item is touched with OOM, Outlook will display the same junk in the preview pane.

The report text is stored in various MAPI recipient properties (click IMessage button in OutlookSpy and go to the GetRecipientTable tab). The problem is the ReportItem object does not expose the Recipients collection. The workaround is to either use Extended MAPI (C++ or Delphi) or Redemption (any language) - its ReportItem.ReportText property does not have this problem:

set oItem = Application.ActiveExplorer.Selection(1)
set oSession = CreateObject("Redemption.RDOSession")
oSession.MAPIOBJECT = Application.Session.MAPIOBJECT
set rItem = oSession.GetRDOObjectFromOutlookObject(oItem)
MsgBox rItem.ReportText

这篇关于Outlook ReportItem.Body返回一些用户混乱的编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆