'Copy Outlook Groups to Excel with Python

First post. Forgive me if I make an rookie mistakes.

In my outlook at work, there are several groups with members. For example, there is a BusinessGroup, FacultyGroup, StudentsGroup, ScienceGroup, etc. Is there any easy way to write a Python script and put it into an Excel spreadsheet?

The alternative which is to manually look up each member of each group and record him in Excel is tedious, painfully slow, and inaccurate.

Thanks in advance for any guidance.

Best, J



Solution 1:[1]

Try something like the following (VBA, shouldn't be too hard to translate to Python):

dim address
set App = CreateObject("Outlook.Application")
set list = App.Session.AddressLists.Item("All Users")
for each entry in list.AddressEntries
  if entry.Type= "EX" Then
    address = entry.GetExchangeUser().PrimarySmtpAddress
  Else
    address = entry.Address
  End If
  Debug.Print entry.Name & " " & address
next

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitry Streblechenko