Ejemplo n.º 1
0
        private void toolStripButtonRemoveUser_Click(object sender, EventArgs e)
        {
            try
            {
                if (listViewGroupUsers.SelectedItems.Count > 0)
                {
                    string group = SelectedGroupName;
                    if (!string.IsNullOrEmpty(group))
                    {
                        if (MessageBox.Show(this, "You are about to remove the selected user from this group. Proceed?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            string[] userParts = listViewGroupUsers.SelectedItems[0].SubItems[2].Text.Split('|');
                            string   userId    = userParts[userParts.Count() - 1];

                            Cursor.Current = Cursors.WaitCursor;
                            EnzoSharePointOp.RemoveUserFromGroup(group, userId);

                            var data = EnzoSharePointOp.GetGroupUsers(group);
                            listViewGroupUsers.Fill(data, "groupId");
                        }
                    }
                }
                else
                {
                    MessageBox.Show(this, "Please select a user to remove", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 2
0
 private void listViewGroups_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         var data = EnzoSharePointOp.GetGroupUsers(SelectedGroupName);
         listViewGroupUsers.Fill(data, "groupId");
     }
     catch (Exception ex) { }
     Cursor.Current = Cursors.Default;
 }
Ejemplo n.º 3
0
        private void toolStripButtonAddUser_Click(object sender, EventArgs e)
        {
            try
            {
                string       group = SelectedGroupName;
                addGroupUser form  = new addGroupUser(EnzoSP, group);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    string loginId = form.LoginId;

                    Cursor.Current = Cursors.WaitCursor;
                    EnzoSharePointOp.AddUserToGroup(group, loginId);

                    var data = EnzoSharePointOp.GetGroupUsers(group);
                    listViewGroupUsers.Fill(data, "groupId");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Cursor.Current = Cursors.Default;
        }