Search code examples
vbaoutlookoutlook-addinoutlook-2010

Show folderpath in Outlook search result


Is there a way to add a column to the search result in outlook, that shows the folderpath instead of only the folders name? If yes, may you provide some tutorials or documentation?

thank you


Solution

  • You can get this information, one email at a time with this.

    http://vboffice.net/sample.html?lang=en&mnu=2&smp=65&cmd=showitem

    Public Sub GetItemsFolderPath()
      Dim obj As Object
      Dim F As Outlook.MAPIFolder
      Dim Msg$
      Set obj = Application.ActiveWindow
      If TypeOf obj Is Outlook.Inspector Then
        Set obj = obj.CurrentItem
      Else
        Set obj = obj.Selection(1)
      End If
      Set F = obj.Parent
      Msg = "The path is: " & F.FolderPath & vbCrLf
      Msg = Msg & "Switch to the folder?"
      If MsgBox(Msg, vbYesNo) = vbYes Then
        Set Application.ActiveExplorer.CurrentFolder = F
      End If
    End Sub