Exemplo n.º 1
0
        /// <summary>
        /// Loads a document library
        /// </summary>
        private void LoadDocuments(string listName)
        {
            listViewDocuments.Items.Clear();
            listViewFolderRoles.Items.Clear();
            listViewFolderPermissions.Items.Clear();

            #region Check limit setting
            int limit = 0;

            if (!int.TryParse(textBoxItemsLimit.Text, out limit))
            {
                MessageBox.Show(this, "Cannot refresh list items: the limit value is not an integer.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            #endregion

            var data = EnzoSharePointOp.GetListDocuments(listName, limit);

            // TODO: Order data based on folders, if DocumentLibrary
            listViewDocuments.Fill(data, "id");

            var data2 = EnzoSharePointOp.GetFoldersWithRoles(listName);
            listViewFolderRoles.Fill(data2, "id");
        }
Exemplo n.º 2
0
        private void listViewFolderRoles_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewFolderRoles.SelectedItems.Count == 0)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (IsDocumentLibrarySelected)
                {
                    string folderName = listViewFolderRoles.SelectedItems[0].SubItems[3].Text;
                    if (folderName.Contains(SelectedListName))
                    {
                        folderName = folderName.Substring(folderName.IndexOf(SelectedListName) + SelectedListName.Length + 1);
                    }

                    var data = EnzoSharePointOp.GetFolderUserPermissions(SelectedListName, folderName);
                    listViewFolderPermissions.Fill(data, "title");
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
        private void listViewLists_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                var data = EnzoSharePointOp.GetFolderUserPermissions(SelectedListName);
                listViewPermissions.Fill(data, "title", "title,loginName,role");

                if (IsDocumentLibrarySelected)
                {
                    listViewDocuments.Items.Clear();
                    listViewFolderRoles.Items.Clear();
                    listViewFolderPermissions.Items.Clear();
                    tabControlDocuments.Dock    = DockStyle.Fill;
                    tabControlDocuments.Visible = true;
                    listViewItems.Visible       = false;
                    LoadDocuments(SelectedListName);
                }
                else
                {
                    listViewItems.Items.Clear();
                    listViewItems.Dock          = DockStyle.Fill;
                    listViewItems.Visible       = true;
                    tabControlDocuments.Visible = false;
                    LoadListItems(SelectedListName);
                }

                listViewFields.Items.Clear();
            }
            catch (Exception ex) { }
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 5
0
        private void linkLabelFieldsRefresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            var data = EnzoSharePointOp.GetListFields(SelectedListName);

            listViewFields.Fill(data, "Id");
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Loads a SharePoint list
        /// </summary>
        private void LoadListItems(string listName)
        {
            listViewItems.Items.Clear();

            #region Check limit setting
            int limit = 0;

            if (!int.TryParse(textBoxItemsLimit.Text, out limit))
            {
                MessageBox.Show(this, "Cannot refresh list items: the limit value is not an integer.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            #endregion

            var data = EnzoSharePointOp.GetListItems(listName, limit);

            listViewItems.Fill(data, "ID");
        }
Exemplo n.º 8
0
        public void RefreshUI()
        {
            try
            {
                ClearUI();
                Cursor.Current = Cursors.WaitCursor;
                if (_connectionBytes != null)
                {
                    // Refresh lists...
                    var data1 = EnzoSharePointOp.GetLists();
                    listViewLists.Fill(data1, "Id");

                    // Refresh Groups...
                    var data2 = EnzoSharePointOp.GetGroups();
                    listViewGroups.Fill(data2, "groupId");
                }
            }
            catch { }
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 9
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;
        }