1

How to add members to a distribution list in exchange2010 using python exchangelib? Any other library available to perform these tasks?

James Z
  • 12,209
  • 10
  • 24
  • 44
Sheik Kalidh
  • 33
  • 1
  • 8

1 Answers1

1

"Also please help me to get list of DL's in exchange server 2010" => see below, code to get members of distribution list.

def get_distro_emails(dist_list):
    credentials = Credentials('username', os.environ.get('password'))
    account = Account('someone@company.com', credentials=credentials, autodiscover=True)
    emails = []
    try:
        for mailbox in account.protocol.expand_dl(dist_list):
            emails.append(mailbox.email_address)
    except Exception as e:
        print(str(e))
    return emails