コード例 #1
0
        public async Task<Web> Connect(string url)
        {
            using (var site = CreateSite(url))
            {
                using (var web = site.OpenWeb())
                {
                    Web = new Web(this)
                    {
                        Id = web.ID,
                        Url = url,
                        Title = web.Title
                    };

                    await Task.Factory.StartNew(() =>
                    {
                        Web.Lists = web.Lists.Cast<SPList>().Select(l => new SList
                        {
                            Web = Web,
                            Title = l.Title,
                            Id = l.ID,
                            IsHidden = l.Hidden
                        }).ToList();
                    });

                    return Web;
                }
            }
        }
コード例 #2
0
        public async Task<Web> Connect(string url)
        {
            if (!url.StartsWith("http")) return null;

            return await Task.Factory.StartNew(() =>
            {
                System.Threading.Thread.Sleep(2000);

                Web = new Web(this)
                {
                    Id = Guid.Empty,
                    Title = "Test",
                    Url = url,
                };

                Web.Lists = new List<SList>
                {
                    new SList {Id = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Title = "List1", Web = Web},
                    new SList {Id = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2), Title = "List2", Web = Web},
                    new SList {Id = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), Title = "List3", Web = Web},
                    new SList {Id = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4), Title = "List4", Web = Web},
                    new SList {Id = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), Title = "List5", Web = Web},
                    new SList {Id = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), Title = "List6", Web = Web},
                    new SList {Id = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7), Title = "List7", Web = Web},
                };

                return Web;
            });
        }
コード例 #3
0
 public void CloseWeb(Web web)
 {
     for (int i = 0; i < Items.Count; i++)
     {
         var queryTab = ToQueryTab(this.Items[i]);
         if(queryTab.List.Web == web) this.Items.RemoveAt(i--);
     }
 }
コード例 #4
0
 private void UcWebs_OnCloseWeb(object sender, Web web)
 {
     ucQueries.CloseWeb(web);
 }
コード例 #5
0
 public ISharePointProvider GetClient(Web web)
 {
     return Webs.FirstOrDefault(client => client.Client.Web == web)?.Client;
 }