none
Developing and Testing Simple Outlook 2010 Add-In RRS feed

  • Question

  • Hello -

    I am having difficulty with a rather simple Outlook 2010 add-in application I'm trying to develop in Visual Studio 2010. Essentially, I want the add-in to create a button on the Outlook ribbon (2010), and when clicked, open a new mail message and put the word "Encrypt" in the subject line.

    Specific issues:
    1) I cannot seem to 'step into' my function in order to test it.

    2) I cannot find a definitive source for creating/populating a ribbon button to call the function.

    Code follows.

    Any assistance is appreciated.

    Thanks,

    Mark


    Imports Outlook = Microsoft.Office.Interop.Outlook
    Public Class ThisAddIn

        Private Sub ThisAddIn_Startup() Handles Me.Startup
            'Populate button here
            'CreateMailItem()
        End Sub

        Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown

        End Sub

        Private Sub CreateMailItem()
            Dim mailItem As Outlook.MailItem = _
                Me.Application.CreateItem(Outlook.OlItemType.olMailItem)
            mailItem.Subject = "ENCRYPT: "
            'mailItem.To = "someone@example.com"
            mailItem.Body = "* Do NOT remove the word 'ENCRYPT' from the Subject *"
            'mailItem.Importance = Outlook.OlImportance.olImportanceLow
            mailItem.Display(True)
        End Sub
       
    End Class

    • Moved by Amanda Zhu Thursday, July 31, 2014 8:35 AM
    Wednesday, July 30, 2014 1:37 PM

Answers

  • Hi Mark,

    1) I cannot seem to 'step into' my function in order to test it.

    I have noticed that you have commented the call:

    Private Sub ThisAddIn_Startup() Handles Me.Startup
             'Populate button here
             'CreateMailItem()
         End Sub
    

    Please cancel the comment.

    2) I cannot find a definitive source for creating/populating a ribbon button to call the function.

    You could create a Ribbon(Visual designer) as the figure:

    Add a button in this new ribbon and call your function in its click event:

    Globals.ThisAddIn.CreateMailItem()

    Please keep CreateMailItem with Public property.

    Hope this helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 31, 2014 9:14 AM
    Moderator

All replies