Ejemplo n.º 1
0
        public static void Run()
        {
            try
            {
                // Set mailboxURI, Username, password, domain information
                string            mailboxUri  = "https://ex2010/ews/exchange.asmx";
                string            username    = "******";
                string            password    = "******";
                string            domain      = "ex2010.local";
                NetworkCredential credentials = new NetworkCredential(username, password, domain);
                IEWSClient        client      = EWSClient.GetEWSClient(mailboxUri, credentials);

                // ExStart:ExpandPublicDistributionList

                MailAddressCollection members = client.ExpandDistributionList(new MailAddress("*****@*****.**"));
                foreach (MailAddress member in members)
                {
                    Console.WriteLine(member.Address);
                }
                // ExEnd:ExpandPublicDistributionList
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }