Consulting

Results 1 to 3 of 3

Thread: get smtp address from selected Folder in Outlook ( Shared )

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Sep 2011
    Posts
    6
    Location

    get smtp address from selected Folder in Outlook ( Shared )

    I know i can get the SMTP address if i select a folder inside outlook , but how can i do the same when a folder is a shared email address
    this code works for a normal outlook email account but when i select a shared mailbox folder it gives an error..

    Private Sub storeAddress_from_DisplayName()
    Dim storeDisplayName As String
    Dim storeSMTPAddress As String
    Dim storeRecipient As Recipient
    ' DisplayName and PrimarySmtpAddress can be the same
    storeDisplayName = ActiveExplorer.CurrentFolder.Store.DisplayName
    Debug.Print " storeDisplayName: " & storeDisplayName
    Set storeRecipient = Session.CreateRecipient(storeDisplayName)
    If storeRecipient.AddressEntry.Type = "EX" Then
        storeSMTPAddress = storeRecipient.AddressEntry.GetExchangeUser.PrimarySmtpAddress
        Debug.Print " storeSMTPAddress: " & storeSMTPAddress
    End If
    End Sub
    Last edited by Aussiebear; 04-08-2022 at 03:30 PM. Reason: Added code tags to supplied code

Posting Permissions

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