2

I want to download an excel attachment from MS Outlook Web App - https://webmail.xyz123.com.sg/owa/auth/logon.aspx?

I have a generic email ID to which my users will be sending source data in an excel format. I want to fetch that attachment with a particular subject and load that in my SQL server.

  1. I cannot access this email ID from outlook desktop app as it is a generic email ID.
  2. I don't have SMTP server details.
  3. I do have credentials for this email ID

I tried some of the codes like below but all of them are trying to access Inbox folder (folder index = 6 ) to access emails, in my case that is not possible as I don't have this email ID's setup in desktop app.

from win32com.client import Dispatch
import datetime as date

outlook = Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder("6")
all_inbox = inbox.Items
val_date = date.date.today()

I expect the output to be -

  1. Access my generic email ID from Outlook web app
  2. Download the excel attachment.
Sanket Kelkar
  • 129
  • 2
  • 9
  • This might be helpful. https://github.com/O365/python-o365 .https://github.com/O365/python-o365/blob/master/O365/mailbox.py#L134 This method lets you download attachments. Or you can fetch already downloaded attachments from onedrive. – Nihal Sangeeth Mar 25 '19 at 07:38
  • Thanks for your comment. https://github.com/O365/python-o365 - this link asks me for client_secret which I cannot setup, and the other link doesn't seem to serve the purpose. Any other way to get this working? Thanks! – Sanket Kelkar Mar 26 '19 at 07:55

0 Answers0