Outlook 365 (2013 & 2016 Version) session.accounts not working

  • Hi Team,

    So far below coding was working fine to send email from particular account but recently we moved to Outlook 365 - 2013 version and now coding is not recognizing the account and i do not want to use SentOnBehalfOfName.

    Kindly advise and help me with the coding.

    Sub Which_Account_Number()
        Dim OutApp As object,I As Long      
        Set OutApp = CreateObject("Outlook.Application")      
            For I = 1 To OutApp.Session.Accounts.Count        
                MsgBox OutApp.Session.Accounts.Item(I) & " : This is account number " & I    
            Next I
    End Sub

    Please note I don't want to use .SentOnBehalfOfName and any coding inside "thisoutlooksession"

    10% paid and here is the transaction ID 50F38114HA831270X

    Thanks in advance for all your help and support.

    Cross posted here: https://www.excelforum.com/exc…ook-365-2013-version.html


  • Hi,

    This code works perfectly in my Office 365 applications (all 2016 version) - which leads me to think this is more a permissions issue than a code issue.

    Have you tried running this code when Outlook is already open?
    Have you tried running this code from an office application that you're running as administrator?

  • Hi SO,

    Thanks for the reply.....

    This coding showing only the default account not the shared mailbox ( configured using more setting -- advance and then add).

    please see the below link for more clarity...


    And I am aware if we configure shared mailbox as separate account then it will work but we don't have permission for this....

    kindly advise.


  • Hi SO,

    Before moving to Outlook 365 it was working fine and yes as you said I don't think that I can achieve the same in outlook 365.

    Thanks for all your help and support.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!