none
VSTO AddIn/Outlook Folder to Display Website in the Outlook Mail Pane Window RRS feed

  • Question

  • Using VS 2017, I am trying to create in Outlook either a custom folder in the Store with all of the other folders(not under the Inbox), or a custom icon on the Ribbon, that when is clicked by the user, a specific web page will Display in the Mail Items Pane Window. I know the Folder click must be possible, because we have a 3rd party app that does this exact behavior.

    I'm able to get partway with both ideas, but not entirely working solutions. The code below creates a Folder in the Outlook store, and displays the website in the Mail Pane when I run the code from Visual Studio. When I close VS, and then re-open Outlook, the folder I created is there, but the website is not displaying when I click on the Folder.

    For the custom icon on the Ribbon, I am only able to create the Custom Group on the Outlook ribbon with an icon. I haven't found any working code that may be able to do this.

            Dim myNamespace As outlook.NameSpace
    
            Dim objFolder As outlook.MAPIFolder
            Dim parentFolder As outlook.MAPIFolder
            Dim objOutlook As outlook._Application
            objOutlook = New outlook.Application()
    
            myNamespace = objOutlook.GetNamespace("MAPI")
            objFolder = myNamespace.GetDefaultFolder(outlook.OlDefaultFolders.olFolderInbox)
    
            parentFolder = objFolder.Parent
    
            'Loop through the folder's - if the IRMWeb Folder exists, don't want to add it again
            For i = 1 To parentFolder.Folders.Count
                If parentFolder.Folders(i).Name = "IRMWeb" Then
                    'Folder already exists - do not add
                    Exit Sub
                End If
            Next
            'We got here, that means the folder doesn't exist so add it
            parentFolder.Folders.Add("IRMWeb", outlook.OlDefaultFolders.olFolderInbox)
            parentFolder.WebViewURL = "https://imanage.com"
            parentFolder.WebViewOn = True
            parentFolder.Display()

    Tuesday, May 22, 2018 6:04 PM

Answers

  • Hi JMANCI,

    Based on the code, you were setting the webViewURL root folder instead of the custom folder you created. For your secnario, you can refer the create a variable for the custom folder you added and you can refer the code below( VBA):

     Set irmFolder = parentFolder.Folders.Add("IRMWeb", Outlook.OlDefaultFolders.olFolderNotes)
     irmFolder.WebViewURL = "https://imanage.com"
     irmFolder.WebViewOn = True
     irmFolder.Display
      

    Please feel free to let me know if you still have issue.

    Regards & Fei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, May 23, 2018 3:31 AM
    Moderator

All replies

  • Hi JMANCI,

    Based on the code, you were setting the webViewURL root folder instead of the custom folder you created. For your secnario, you can refer the create a variable for the custom folder you added and you can refer the code below( VBA):

     Set irmFolder = parentFolder.Folders.Add("IRMWeb", Outlook.OlDefaultFolders.olFolderNotes)
     irmFolder.WebViewURL = "https://imanage.com"
     irmFolder.WebViewOn = True
     irmFolder.Display
      

    Please feel free to let me know if you still have issue.

    Regards & Fei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, May 23, 2018 3:31 AM
    Moderator
  • That code seems to work when running from Visual Studio. I just need to get the VSTO add in working. Will mark as the answer. Thanks!
    Thursday, May 24, 2018 1:27 PM