/// <summary> /// Gets a list item of model type <typeparamref name="T"/> with the specified unique ID. /// </summary> /// <typeparam name="T">Model type.</typeparam> /// <param name="manager">A model manager instance.</param> /// <param name="uniqueId">Unique ID.</param> /// <returns>A list item; or *null* if there is no list item with the specified unique ID.</returns> public static T GetItemByUniqueId <T>(this SPModelManager <T> manager, Guid uniqueId) { return(manager.GetItems(Caml.Equals(SPBuiltInFieldName.UniqueId, uniqueId), 1u).FirstOrDefault()); }
/// <summary> /// Gets a list item of model type <typeparamref name="T"/> with the specified list item ID. /// </summary> /// <typeparam name="T">Model type.</typeparam> /// <param name="manager">A model manager instance.</param> /// <param name="id">List item ID.</param> /// <returns>A list item; or *null* if there is no list item with the specified ID.</returns> public static T GetItemByID <T>(this SPModelManager <T> manager, int id) { return(manager.GetItems(Caml.Equals(SPBuiltInFieldName.ID, id), 1u).FirstOrDefault()); }