Wednesday, August 20, 2014

Outlook ReportItem trick to get ReportItem.SenderEmailAddress

Report Items  don't have any direct methods of getting the Reportitem..SenderEmailAddress that I have found- so here is a work around I did figure out...

    Select Case TypeName(objObject)
    Case "ReportItem"  
                            ''This is terrible- but the report item sender is not exposed...  
                            ''Is there a better way somewhere? API call maby?  
      Dim strFrom                 ''String for FROM email address  
      Dim msg As MailItem             ''container for reference mail item message  
      Set objReport = objObject          ''Set the report object to current mail item  
      Set msg = objReport.Actions.Item(1).Execute ''Execute a reply  
      strFrom = msg.Recipients.Item(1).Address   ''Get the resolved address from the 'to' of the reply  
      msg.Delete                  ''delete the unused draft  
End Select

No comments:

Post a Comment