VSTO - AddIn for Office Outlook 2010 - Visual studio 2010 RRS feed

  • Question

  • Hi,

    I have a problem. In my addin when click "New E-mail" then a new inspector window will open. In my backend code i'm gonna send the mail to to address if the user enters a email in the to.address field. If the user dont insert a to address then from backend code i'm gonna set a email and send the mail. The problem is i can not check for if a to address are inserted or not.

    Right now i'm checking  if(Currentmail.To !=null)

    But it seems like even the user inserts something in to address and then delete it again and click "Send" then it seems like the to address is not reqoignized as empty. You have to click button "To..." to force the field to be sat. When the button is yellow then it seems like the field has been sat. Strange but real. I hope you understand.

    Friday, March 7, 2014 2:18 PM


  • Hi Erkan,

    The To property of the MailItem class represents a semicolon-delimited String list of display names for the To recipients for the Outlook item. This property contains the display names only. Instead, the Recipients collection should be used to modify this property. Recipients represent all the recipients for the Outlook item.

    Sub CreateStatusReportToBoss()  
     Dim myItem As Outlook.MailItem 
     Dim myRecipient As Outlook.Recipient 
     Set myItem = Application.CreateItem(olMailItem)  
     Set myRecipient = myItem.Recipients.Add("Dan Wilson")  
     If myRecipient.Resolved Then
        myItem.Subject = "Status Report"  
     End If
    End Sub

    Friday, March 7, 2014 2:41 PM