public async Task AddQuery(SList list) { if (list == null) return; if (list.Fields?.Count == 0) { try { StatusNotification.NotifyWithProgress("Prepairing list: " + list.Title); await list.Web.Client.FillListFields(list); StatusNotification.Notify("List ready"); } catch (Exception) { StatusNotification.Notify("Prepairing list failed"); return; } } this.SelectedIndex = this.Items.Add( new ClosableTabItem { HeaderText = list.Title, Content = new QueryTab(list) {Margin = new Thickness(4) } }); CommandManager.InvalidateRequerySuggested(); }
public async Task FillContentTypes(SList list, bool fillAlsoWeb = true) { using (var context = CreateContext(list.Web.Url)) { if (list.ContentTypes == null) { var serverList = context.Web.Lists.GetById(list.Id); context.Load(serverList.ContentTypes, contentTypes => contentTypes.Include( ct => ct.StringId, ct => ct.Name )); await Task.Factory.StartNew(() => context.ExecuteQuery()); list.ContentTypes = Converter.ToContentTypes(serverList.ContentTypes); } if (list.Web.ContentTypes == null) { context.Load(context.Web.ContentTypes, contentTypes => contentTypes.Include( ct => ct.StringId, ct => ct.Name )); await Task.Factory.StartNew(() => context.ExecuteQuery()); list.Web.ContentTypes = Converter.ToContentTypes(context.Web.ContentTypes); } } }
public QueryTab(SList list) { InitializeComponent(); List = list; ucItems.List = list; ucQueryBuilder.DataContext = List; ucQueryBuilder.Changed += (sender, args) => ucQuery.Text = ucQueryBuilder.Build().ToXml().ToString(); DataObject.AddPastingHandler(ucQuery, UcQuery_OnPaste); }
public async Task FillContentTypes(SList list, bool fillAlsoWeb = true) { using (var site = CreateSite(list.Web.Url)) { using (var web = site.OpenWeb()) { await Task.Factory.StartNew(() => { if (list.ContentTypes == null) { var serverList = web.Lists.TryGetList(list.Title); list.ContentTypes = Converter.ToContentTypes(serverList.ContentTypes); } if (list.Web.ContentTypes == null) { list.Web.ContentTypes = Converter.ToContentTypes(web.ContentTypes); } }); } } }
public async Task FillListFields(SList list) { using (var site = CreateSite(list.Web.Url)) { using (var web = site.OpenWeb()) { await Task.Factory.StartNew(() => { var serverList = web.Lists.TryGetList(list.Title); list.Fields = serverList.Fields.Cast<SPField>() .Select(f => CreateField(f)) .ToList(); }); } } }
public async Task FillContentTypes(SList list, bool fillAlsoWeb = true) { await Task.Factory.StartNew(() => { System.Threading.Thread.Sleep(2000); list.ContentTypes = new List<ContentType> { new ContentType { Id= "0x01231", Name = "Folder"}, new ContentType { Id= "0x01232", Name = "Item"}, }; list.Web.ContentTypes = new List<ContentType> { new ContentType { Id= "0x0123", Name = "Folder"}, new ContentType { Id= "0x0124", Name = "Item 1"}, new ContentType { Id= "0x0125", Name = "Item 2"}, new ContentType { Id= "0x0126", Name = "Item 3"}, }; }); }
public async Task FillListFields(SList list) { await Task.Factory.StartNew(() => { System.Threading.Thread.Sleep(2000); var fields = new List<Field> { new Field { Group = "1", Title = "Text", Type=FieldType.Text, InternalName = Internals.Text }, new Field { Group = "1", Title = "User", Type=FieldType.User, InternalName = Internals.User }, new FieldDateTime { Group = "1", Title = "Date", Type=FieldType.DateTime, InternalName = Internals.Date , DateOnly = true}, new FieldDateTime { Group = "1", Title = "DateTime",Type=FieldType.DateTime, InternalName = Internals.DateTime , DateOnly = false}, new FieldLookup { Group = "2", Title = "Lookup", Type=FieldType.Lookup, InternalName = Internals.Lookup }, new FieldLookup { Group = "2", Title = "MultiLookup",Type=FieldType.Lookup, InternalName = Internals.MultiLookup , AllowMultivalue = true}, new Field { Group = "2", Title = "Integer", Type=FieldType.Integer, InternalName = Internals.Integer }, new Field { Group = "3", Title = "Note", Type=FieldType.Note, InternalName = Internals.Note }, new Field { Group = "3", Title = "Url", Type=FieldType.Url, InternalName = Internals.Url }, new FieldChoice { Group = "3", Title = "Choice", Type=FieldType.Choice, InternalName = Internals.Choice , Choices = new[] {"Choice1", "Choice2", "Choice3"}}, new Field { Group = "3", Title = "Boolean", Type=FieldType.Boolean, InternalName = Internals.Boolean }, new Field { Group = "4", Title = "Readonly", Type=FieldType.Text, InternalName = Internals.Readonly , IsReadonly = true}, new Field { Group = "4", Title = "Hidden", Type=FieldType.Text, InternalName = Internals.Hidden , IsHidden = true}, new Field { Group = "4", Title = "Number", Type=FieldType.Number, InternalName = Internals.Number }, new Field { Group = "4", Title = "Computed", Type=FieldType.Computed, InternalName = Internals.Computed }, new Field { Group = "4", Title = "Currency", Type=FieldType.Currency, InternalName = Internals.Currency }, new Field { Group = "4", Title = "MultiChoice", Type=FieldType.MultiChoice, InternalName = Internals.MultiChoice }, new Field { Group = "5", Title = "Guid", Type=FieldType.Guid, InternalName = Internals.Guid }, new Field { Group = "5", Title = "Calculated", Type=FieldType.Calculated, InternalName = Internals.Calculated }, new Field { Group = "5", Title = "File", Type=FieldType.File, InternalName = Internals.File }, new Field { Group = "5", Title = "Attachments", Type=FieldType.Attachments, InternalName = Internals.Attachments }, new Field { Group = "5", Title = "ContentTypeId", Type=FieldType.ContentTypeId, InternalName = Internals.ContentTypeId }, new Field { Group = "5", Title = "Geolocation", Type=FieldType.Geolocation, InternalName = Internals.Geolocation }, new Field { Group = "5", Title = "SortTest", Type=FieldType.Geolocation, InternalName = Internals.SortTest }, }; list.Fields = fields; }); }
public ListItem(SList list) { List = list; }