[Python] Duplicates in outlook GAL (python)

Discussão em 'Python' iniciado por Stack, Fevereiro 7, 2025.

  1. Stack

    Stack Membro Participativo

    Would anyone be able to help me with this issue? I'm making an App that looks in a GAL (global address list) in Outlook and finds the EX-user and stuff, I have that working and all but when I am getting the contacts/address entries from doing this:

    outlook = win32com.client.Dispatch("Outlook.Application")
    namespace = outlook.GetNamespace("MAPI")
    address_list = namespace.AddressLists.Item("Global Address List")
    gal = address_list.AddressEntries


    there are people who have the same Name and the same display name as others while being unique. when I need the EX-user I do

    gal.item("LastName, FirstName").GetExchangeUser(),


    but as there are some duplicates In gal with the same name it always returns first one.

    was wondering if any really smart person would know how I could detect duplicates, remove duplicates, and whatnot. I have a list of names to look at through the gal and what I thought I could do is find the contact by doing gal.item("LastName, FirstName") and getting the position of it and then moving to the next item until there is a different name. But idk how to get the position when I do .item("name").

    Any help is appreciated, Marcus. Note: I would like to avoid the loop through gal as there are a lot of people in there.

    Continue reading...

Compartilhe esta Página