HI all,

I have created a new tab in outlook ribbon (Visual Studio 2017 - VSTO Add-Ins Outlook 2016 ) and when user clicks on that, then a user Control is visible to user. On this User control I have a text and a button
What I need is when the user click on the button then the text which is filled by the user to be added as category in the current message

I have done it within VBA of Outlook but I need to implement it as Add-in

VBA Code:


Code:
Public Sub AddTag()

SetCategory text1
End Sub


Private Sub SetCategory(Tag As String)
  Dim Mail As Object
  Set Mail = Application.ActiveExplorer.Selection.Item(1)
   
  
  
Debug.Print Mail.Categories
 arr = Split(Mail.Categories, ",")
    If UBound(arr) >= 0 Then

' Check for Category
    For i = 0 To UBound(arr)
      If Trim(arr(i)) = StrCat Then
        ' remove it
            arr(i) = ""
            Mail.Categories = Join(arr, ",")
        ' Category Removed, exit
            Exit Sub
        End If
        Next
    End If
    
' Category not found, add it
    Mail.Categories = StrCat & "," & Mail.Categories

End Sub
Do you have any idea how can I do it within a module of Ribbon Add-IN ?

Regards
Micahel