protected override void OnParsing(XElement existingView) { var existingQuery = existingView.ElementIgnoreCase(Query.QueryTag); if (existingQuery != null) { Query = new Query(existingQuery); } var existingRowLimit = existingView.ElementIgnoreCase(CamlRowLimit.RowLimitTag); if (existingRowLimit != null) { RowLimit = new CamlRowLimit(existingRowLimit); } var existingViewFields = existingView.ElementIgnoreCase(ViewFieldsCamlElement.ViewFieldsTag); if (existingViewFields != null) { ViewFields = new ViewFieldsCamlElement(existingViewFields); } var existingJoins = existingView.ElementIgnoreCase(JoinsCamlElement.JoinsTag); if (existingJoins != null) { Joins = new JoinsCamlElement(existingJoins); } var projectedFields = existingView.ElementIgnoreCase(ProjectedFieldsCamlElement.ProjectedFieldsTag); if (projectedFields != null) { ProjectedFields = new ProjectedFieldsCamlElement(projectedFields); } }
public View(IEnumerable <string> viewFields, IEnumerable <Join> joins, IEnumerable <CamlProjectedField> projectedFields, int rowLimit = 0, bool?paged = null) : base(ViewTag) { Query = new Query(); ViewFields = new ViewFieldsCamlElement(viewFields); Joins = new JoinsCamlElement(joins); ProjectedFields = new ProjectedFieldsCamlElement(projectedFields); RowLimit = new CamlRowLimit(rowLimit, paged); Scope = ViewScope.DefaultValue; }
public static ViewFieldsCamlElement ViewField(this ViewFieldsCamlElement camlViewFields, params CamlFieldRef[] viewFields) { if (@viewFields != null) { var mergedViewFields = new List <CamlFieldRef>(); if (camlViewFields.Any()) { mergedViewFields.AddRange(camlViewFields); } mergedViewFields.AddRange(viewFields); camlViewFields.ViewField(mergedViewFields.ToArray()); } return(camlViewFields); }
public static ViewFieldsCamlElement ViewField(this ViewFieldsCamlElement camlViewFields, params string[] viewFields) { if (@viewFields != null) { var mergedViewFields = new List <CamlFieldRef>(); if (camlViewFields.Any()) { mergedViewFields.AddRange(camlViewFields); } mergedViewFields.AddRange(viewFields.Where(@viewField => !mergedViewFields.Exists(field => field.Name == @viewField)).Select(viewField => new CamlFieldRef { Name = viewField })); camlViewFields.ViewField(mergedViewFields.ToArray()); } return(camlViewFields); }