Beispiel #1
0
        // Method to Call for SharePoint Site Lists - onInitialise Window
        public void GetSiteLists(string Url)
        {
            var spoL = new SPOLogic(Url);
            IEnumerable <Microsoft.SharePoint.Client.List> lists = spoL.getWebLists(Url, CredManager).Where(l => !l.Hidden);

            //LBLists.Items.Clear();
            foreach (Microsoft.SharePoint.Client.List lst in lists)
            {
                //LBLists.Items.Add(lst.Title + " - (" + lst.ItemCount + ")");
            }
        }// End Method
Beispiel #2
0
        }// End Method

        // Method - TreeViewItem.Expand Listener - Call for Site Lists
        private void Folder_Expanded(object sender, RoutedEventArgs e)
        {
            var item = (TreeViewItem)sender;

            // If the item only contains the dumy data
            if (item.Items.Count != 1 || item.Items == null)
            {
                return;
            }
            //Clear dummy item
            item.Items.Clear();

            // Get Site library
            var SitePath = (string)item.Tag;

            Task.Factory.StartNew(() =>
            {
                // Call for the expended site Web
                var spoL = new SPOLogic(CredManager);
                // Filter on not hidden file
                IEnumerable <Microsoft.SharePoint.Client.List> lists = spoL.getWebLists(SitePath, CredManager).Where(l => !l.Hidden);

                item.Dispatcher.Invoke(() =>
                {
                    // Creating TreeeViewIems from lists
                    foreach (var list in lists)
                    {
                        var subitem = new TreeViewItem
                        {
                            Header = list.Title + " (" + list.ItemCount + ") - " + list.BaseTemplate.ToString(),
                            Tag    = list.BaseTemplate.ToString(),
                        };

                        item.Items.Add(subitem);
                    }
                }); // End Dispatch
            });     // End Task
        }// End Method