Results 1 to 3 of 3

Thread: vb.net outlook addin right-click attachment

  1. #1

    Thread Starter
    Lively Member SpagettiProg's Avatar
    Join Date
    Dec 2004
    Location
    Miami, Florida
    Posts
    82

    vb.net outlook addin right-click attachment

    I need create an add-in for outlook 2000
    I'm trying to do it in vb.net.

    What I'm trying to do is add another menu item, when
    you right click on an attachment.
    Say....
    Open
    Save As
    MyFunction
    blah
    blah
    properties

    I have a few questions.
    Is this possible using the outlook object model ?
    http://msdn.microsoft.com/library/de...HV01049998.asp
    If so, what object should I be researching ?

    If anyone can share anything. thoughts, code snips, emotional troubles,
    that would be great. I'm all ears.


    Thanks

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vb.net outlook addin right-click attachment

    I take it that this is only for the MailItems type. I believe that there is a way but is very complicated,
    especially when you factor in the fact that you can have multiple Outlook Explorer instances.

    Just about the only way for a MailItem is to use the Actions of a custom Outlook Form for it.
    The major problem is that your form will have to be attached when or if you send or forward it. In doing so the
    receipient will not be able to open the email if they dont have Outlook.

    Its allot easier to add a toolbar buton or menu item.

    If you want to do the context menu then you need to attach to the CommandBars collection and _OnUpdate
    event of the commandbars object. Its in this event that you can add a new CommandBarButton to represent the
    new menu item and attach it to the context menu commandbar. In 2002 and 2003 the CommandBar is called
    "Context Menu". I dont know what it is for 2000 though.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member SpagettiProg's Avatar
    Join Date
    Dec 2004
    Location
    Miami, Florida
    Posts
    82

    Re: vb.net outlook addin right-click attachment

    Thanks for your feedback. The adding to a context menu of an attachment does not seem very promising, since it the attachment object does contain a actions.add property.

    I will just go with something like this....


    VB Code:
    1. Private Sub my_inspector_event(ByVal mInspector As Outlook.Inspector) Handles inspector.NewInspector
    2.  
    3.  
    4.         Dim objItem As Object
    5.         Dim objAction As Outlook.Action
    6.  
    7.         If explorer.Selection.Count > 0 Then
    8.             objItem = explorer.Selection.Item(1)
    9.             If objItem.Class = explorer.Selection.Class.olMail Then
    10.  
    11.                     If objAction Is Nothing Then
    12.                         objAction = m_objMailItem.Actions.Add
    13.  
    14.                     With objAction
    15.  
    16.                         .Enabled = True
    17.                         .Name = "Send to Docket"
    18.                         '.ShowOn = OlActionShowOn.olMenu
    19.                         .ShowOn = OlActionShowOn.olMenuAndToolbar
    20.                     End With
    21.    
    22.                 End If
    23.                 End If
    24.  
    25.         End If
    26.  
    27.         objItem = Nothing
    28.         objAction = Nothing
    29.  
    30.     End Sub


    Though a new problem arose, and I don't know if I should ask in a new thread.
    Basically, I don't know how to detect if a context menu already exist. So evertime, I open the email it keeps adding more buttons to it.

    anyone know about this one ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width