/// <summary> /// Returns filtered list of items by checking the field whether contains specific value. /// </summary> /// <param name="list"></param> /// <param name="value"></param> /// <param name="field"></param> /// <returns></returns> public static IEnumerable <SPListItem> GetItemsByFieldContains(this SPList list, string value, string field) { var query = new XElement("Where", new XElement("Contains", new XElement("FieldRef", new XAttribute("Name", field)), new XElement("Value", value))); return(list.GetItemsByQuery(query.ToString(SaveOptions.DisableFormatting))); }
/// <summary> /// Returns all items of the list without any filtering. /// </summary> /// <param name="list"></param> /// <returns></returns> public static IEnumerable <SPListItem> GetItems(this SPList list) { return(list.GetItemsByQuery(String.Empty)); }