How to get messages contained in Message or IBodypart objects using CDO?


Please find the VBScript code-snippet to get or extract the messages that are contained in the other objects like Message or IBodyPart.

 

   1:  ' Please provide the value for sVal  
   2:  Function getMsg(sVal As IBodyPart) As Message
   3:      Dim Msg
   4:      Set Msg = CreateObject("CDO.Message")
   5:      Dim getVal
   6:      Set getVal = Msg.DataSource
   7:      getVal.OpenObject sVal, "IBodyPart"
   8:      Set getMsg = Msg
   9:  End Function
Skip to main content