。Mailitem的主体未返回任何内容
我正在使用entryID来访问入站电子邮件,并使用Application.Session.GetItemFromID设置对象
strID = olitem.EntryID
Set olitem = Application.Session.GetItemFromID(strID)
一旦我设置了olitem
Set olitem = Application.Session.GetItemFromID(strID)
它显示电子邮件已被访问,但是当sText = olitem.Body运行时,stext最终为空。
Sub ParseEPDMRequest(olitem As Outlook.MailItem)
Dim arr() As String
Dim ECONum As String
Dim ReqID As String
Dim sText As String
Dim strID As String
strID = olitem.EntryID
Set olitem = Application.Session.GetItemFromID(strID)
sText = olitem.Body
arr = Split(olitem.Body, ":")
arr = Split(arr(15), " ")
ECONum = GetECONum(arr(8))
sText = olitem.Subject
ReqID = GetReqId(sText)
Call TEAMtoEPDMPush(ECONum & ".xml", ReqID)
End Sub
答案 0 :(得分:0)
在某些情况下,该邮件可以没有纯文本正文。您必须检查正文的格式(see BodyFormat property):
strID = olitem.EntryID
Set olitem = Application.Session.GetItemFromID(strID)
If olitem.BodyFormat=OlBodyFormat.olFormatPlain Then
sText = olitem.Body
...
ElseIf olitem.BodyFormat=OlBodyFormat.olFormatHTML Then
...