[Python] Fail to extract outlook mails of current week in shared folder using python [closed]

Discussão em 'Python' iniciado por Stack, Março 12, 2025.

  1. Stack

    Stack Membro Participativo

    I tried to extract mails from a shared folder on outlook, which I have access to.

    However, I am not able to get the mails for current week. For example, today is 12 Mar 2025, and only mail from 4 Mar 2025 and before are accessible to my python code.

    Everything is normal when I applied the same code to my personal inbox folder instead.

    How can I diagnose the reason and solution of the delay on shared folder? Thanks

    Below is the python code I applied. It only prints out mails from one week ago...

    import win32com.client

    outlook = win32com.client.Dispatch("Outlook.Application")
    namespace = outlook.GetNamespace("MAPI")
    shared_folder = namespace.Folders["abc"]
    subfolder = shared_folder.Folders["Inbox"]
    items = subfolder.Items
    items.Sort("[ReceivedTime]", True)

    for i in range(50):
    email = items.GetNext()
    if email:
    print(email.Subject)
    else:
    break

    Continue reading...

Compartilhe esta Página