Esempio n. 1
0
        /// <summary>
        /// Allow the uer to select a subscriber to add to the distribution list as a member - you'd follow the same procedure to add a list just use
        /// the AddMemberPublicList function off the DistributionList class instead of the AddMemberUser.
        /// </summary>
        private void buttonAddUser_Click(object sender, EventArgs e)
        {
            using (FormFindUser oForm = new FormFindUser())
            {
                oForm.ShowDialog();
                if (oForm.DialogResult == DialogResult.Cancel)
                {
                    //user canceled - nothing to do here
                    return;
                }

                WebCallResult res = DistributionList.AddMemberUser(GlobalItems.CurrentConnectionServer,
                                                                   DistributionListObjectId,
                                                                   oForm.UserObjectId);

                //if the user added ok force the membership grid to update to reflect that - otherwise give the user the error message and exit.
                if (res.Success)
                {
                    MessageBox.Show("User added");
                    LoadMembers();
                }
                else
                {
                    //note, adding a duplicate member will result in an error.
                    MessageBox.Show("Error adding user:" + res.ToString());
                }
            }
        }
Esempio n. 2
0
        public void DistributionList_MembershipEdit()
        {
            //Add a user to it.
            UserBase      oUser;
            WebCallResult res = UserBase.GetUser(out oUser, _connectionServer, "", "operator");

            Assert.IsTrue(res.Success, "Getting operator for new distribution list failed: " + res.ToString());

            res = _tempList.AddMemberUser(oUser.ObjectId);
            Assert.IsTrue(res.Success, "Adding operator user to new distribution list failed: " + res.ToString());

            //Add a list to it
            DistributionList oNewList;

            res = DistributionList.GetDistributionList(out oNewList, _connectionServer, "", "allvoicemailusers");
            Assert.IsTrue(res.Success, "Get AllVoiceMail users list failed: " + res.ToString());

            res = _tempList.AddMemberList(oNewList.ObjectId);
            Assert.IsTrue(res.Success, "Adding AllUsersDistribution list as a member to the new list failed: " + res.ToString());

            //get count - make sure it equals 2
            List <DistributionListMember> oMemberList;

            res = _tempList.GetMembersList(out oMemberList);
            Assert.IsTrue(res.Success, "Getting membership list from new distribution list failed: " + res.ToString());
            Assert.AreEqual(oMemberList.Count, 2, "Membership list fetch from new distribution list did not return 2 members as it should.");

            //remove both members from it - also exercise the DistributionListMember toString and DumpAll here
            foreach (DistributionListMember oMember in oMemberList)
            {
                Console.WriteLine(oMember.ToString());
                Console.WriteLine(oMember.DumpAllProps());
                res = _tempList.RemoveMember(oMember.ObjectId);

                Assert.IsTrue(res.Success, "Removal of member from new distribution list failed for:" + oMember);
            }

            //get count - make sure it equals 0
            res = _tempList.GetMembersList(out oMemberList);
            Assert.IsTrue(res.Success, "Failed getting members list:" + res);
            Assert.AreEqual(oMemberList.Count, 0, "After removal of members from the new distribution list the count of members reports more than 0.");
        }