public EntityReferenceValue[] GetFirstPageValues() { return(RetrieveAllService.Execute(EntityLogicalName).Values .Select(k => new EntityReferenceValue() { Id = k.Id, LogicalName = EntityLogicalName, DisplayName = GetRowDisplayName(k.Values) }) .OrderBy(k => k.DisplayName) .ToArray()); }
public EntityReferenceValue[] SearchValues(string searchText) { return(RetrieveAllService.Execute(EntityLogicalName).Values .Where(k => { if (string.IsNullOrEmpty(searchText)) { return true; } var name = GetRowDisplayName(k.Values); return string.IsNullOrEmpty(name) && name.ToLower().IndexOf(searchText.ToLower()) > -1; }) .Select(k => new EntityReferenceValue() { Id = k.Id, LogicalName = EntityLogicalName, DisplayName = GetRowDisplayName(k.Values) }) .OrderBy(k => k.DisplayName) .ToArray()); }