private void buttonSelectRecipients_Click(object sender, EventArgs e) { formSelectUsers selectUsers = new formSelectUsers(true, 0); if (selectUsers.ShowDialog() == DialogResult.OK) { hMailServer.DistributionListRecipients recipients = representedObject.Recipients; List<string> listUsers = selectUsers.GetSelectedTexts(); foreach (string address in listUsers) { hMailServer.DistributionListRecipient recipient = recipients.Add(); recipient.RecipientAddress = address; recipient.Save(); Marshal.ReleaseComObject(recipient); } Marshal.ReleaseComObject(recipients); ListRecipients(); } }
private void buttonAddPermission_Click(object sender, EventArgs e) { SaveRightsForPermission(); formSelectUsers selectUsersDlg = new formSelectUsers(false, 0); if (selectUsersDlg.ShowDialog() == DialogResult.OK) { listACL.SelectedItems.Clear(); List<int> selectedItems = selectUsersDlg.GetSelectedIDs(); eACLPermissionType type = selectUsersDlg.Type; if (type == eACLPermissionType.ePermissionTypeAnyone) { IMAPFolderPermission permission = _folder.Permissions.Add(); permission.PermissionType = eACLPermissionType.ePermissionTypeAnyone; permission.Save(); ListViewItem listItem = ListPermission(permission); listItem.Selected = true; listACL.Focus(); } else { foreach (int itemID in selectedItems) { IMAPFolderPermission permission = _folder.Permissions.Add(); switch (type) { case eACLPermissionType.ePermissionTypeGroup: { permission.PermissionType = eACLPermissionType.ePermissionTypeGroup; permission.PermissionGroupID = itemID; break; } case eACLPermissionType.ePermissionTypeUser: { permission.PermissionType = eACLPermissionType.ePermissionTypeUser; permission.PermissionAccountID = itemID; break; } default: { throw new Exception("Trying to add unknown object type to permission list"); } } permission.Save(); ListViewItem listItem = ListPermission(permission); listItem.Selected = true; listACL.Focus(); } } } }
private void buttonAddPermission_Click(object sender, EventArgs e) { SaveRightsForPermission(); formSelectUsers selectUsersDlg = new formSelectUsers(false, 0); if (selectUsersDlg.ShowDialog() == DialogResult.OK) { listACL.SelectedItems.Clear(); List <int> selectedItems = selectUsersDlg.GetSelectedIDs(); eACLPermissionType type = selectUsersDlg.Type; if (type == eACLPermissionType.ePermissionTypeAnyone) { IMAPFolderPermission permission = _folder.Permissions.Add(); permission.PermissionType = eACLPermissionType.ePermissionTypeAnyone; permission.Save(); ListViewItem listItem = ListPermission(permission); listItem.Selected = true; listACL.Focus(); } else { foreach (int itemID in selectedItems) { IMAPFolderPermission permission = _folder.Permissions.Add(); switch (type) { case eACLPermissionType.ePermissionTypeGroup: { permission.PermissionType = eACLPermissionType.ePermissionTypeGroup; permission.PermissionGroupID = itemID; break; } case eACLPermissionType.ePermissionTypeUser: { permission.PermissionType = eACLPermissionType.ePermissionTypeUser; permission.PermissionAccountID = itemID; break; } default: { throw new Exception("Trying to add unknown object type to permission list"); } } permission.Save(); ListViewItem listItem = ListPermission(permission); listItem.Selected = true; listACL.Focus(); } } } }
private void buttonSelect_Click(object sender, EventArgs e) { formSelectUsers selectUsers = new formSelectUsers(true, 0); if (selectUsers.ShowDialog() == DialogResult.OK) { hMailServer.GroupMembers members = representedObject.Members; List<int> listUsers = selectUsers.GetSelectedIDs(); foreach (int userID in listUsers) { hMailServer.GroupMember member = members.Add(); member.AccountID = userID; member.Save(); Marshal.ReleaseComObject(member); } Marshal.ReleaseComObject(members); ListGroupMembers(); } }