public static void Run()
        {
            // ExStart:AddMembersToPrivateDistributionList
            IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain");

            ExchangeDistributionList[] distributionLists = client.ListDistributionLists();
            MailAddressCollection      newMembers        = new MailAddressCollection();

            newMembers.Add("*****@*****.**");
            newMembers.Add("*****@*****.**");
            client.AddToDistributionList(distributionLists[0], newMembers);
            // ExEnd:AddMembersToPrivateDistributionList
        }
Esempio n. 2
0
        public static void Run()
        {
            // ExStart:AddMembersWithoutListing
            IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain");
            ExchangeDistributionList distributionList = new ExchangeDistributionList();

            distributionList.Id        = "list's id";
            distributionList.ChangeKey = "list's change key";
            MailAddressCollection newMembers = new MailAddressCollection();

            newMembers.Add("*****@*****.**");
            client.AddToDistributionList(distributionList, newMembers);
            // ExEnd:AddMembersWithoutListing
        }
        public static void Run()
        {
            // ExStart:DeleteMembersWithoutListing
            IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain");
            ExchangeDistributionList distributionList = new ExchangeDistributionList();

            distributionList.Id        = "list's id";
            distributionList.ChangeKey = "list's change key";
            MailAddressCollection membersToDelete = new MailAddressCollection();
            MailAddress           addressToDelete = new MailAddress("address", true);

            //addressToDelete.Id.EWSId = "member's id";
            membersToDelete.Add(addressToDelete);
            client.AddToDistributionList(distributionList, membersToDelete);
            // ExEnd:DeleteMembersWithoutListing
        }