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; } } }
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; }); }
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--); } }
private void UcWebs_OnCloseWeb(object sender, Web web) { ucQueries.CloseWeb(web); }
public ISharePointProvider GetClient(Web web) { return Webs.FirstOrDefault(client => client.Client.Web == web)?.Client; }