samedi 9 juillet 2016

Java- Fetch outlook mail item like without using password like VBA

I use Outlook 2013 to view my mails and I am able to read my outlook mail items through VBA

Sub download_outlook_mail()
    Dim mailItem As Outlook.mailItem
    Dim myFolder As Outlook.MAPIFolder

    Set myFolder = Outlook.Session.Folders("user@domainname.com").Folders("Inbox")


    For Each mailItem In myFolder.Items
        Debug.Print mailItem.ReceivedTime
    Next mailItem
End Sub

Moreover, I am trying to do the same with Java. However, in Java we have to set up a connection using user id and password

Session session = Session.getInstance(prop, null);
Store store = session.getStore();
store.connect("imap-mail.outlook.com", "user@domainname.com", "pswd");

How can Outlook connection be created in Java only using user id like VBA instead of using both user id and password.

Can I get the Outlook connection from the system which I have configure first time for Outlook 2013.

Aucun commentaire:

Enregistrer un commentaire