Multiple keyword search with a LINQ query using the CRM API

One of my customers wanted a simple web service to access CRM data from a web portal he was creating. The normal CRM API was to complex for this so we decided to make a WCF service that connected to CRM via the CRM API. One of the functions he wanted was a multiple keyword search.

var searchfrase = "hebbink com";
var keywords = searchfrase.Split(' ');
var query = AccountSet;

foreach (var x in keywords)
    query = query.Where(a => (a.AccountNumber.Contains(x) || a.Name.Contains(x)));

var accounts = query.ToList();

foreach (var account in accounts)
    Console.Write(account.Name + Environment.NewLine);

Just run this piece of code in LINQPad for CRM as a C# Statement and you will get the following result:

Works like a charm :-)

Comments (9) -

  • custom essay writing service

    12/8/2016 4:57:06 AM |

    Thank you for share this information i like this information very much and its very useful to me. i have more some doubts about this API please share more information about this Multiple keyword search with a LINQ query.

  • paper writing service

    2/8/2017 7:14:11 PM |

    That was interesting. Thank you for adding those materials here. I think that some of those aspects are already familiar to us.

  • online essay writers

    4/17/2017 8:50:56 PM |

    I think I should modify it to solve my problem. It would be great if you'll add more curious ideas later.

  • category how to page 4

    5/10/2017 11:50:14 AM |

    The report is pretty clear, so I will find some time to fix my problem. Your clarification on more extended multiple keyword search may be required.

  • eqotuti

    5/12/2017 10:37:39 PM |


  • ybivir

    5/15/2017 11:24:09 PM |

    moja strona

  • OEMUM4Uf

    8/28/2017 11:48:24 AM |

    70550 211996We�re glad to become visitor on this pure site, regards in this rare info! 347486

  • arvenholzkissen

    8/28/2017 8:17:34 PM |

    336688 150460What a lovely blog. I�ll surely be back. Please preserve writing! 489342

  • roofing contractor

    8/30/2017 1:40:48 PM |

    501247 97618This is a fantastic web page, could you be interested in performing an interview about just how you designed it? If so e-mail me! 222921

  • Read Full Report

    9/1/2017 11:15:06 PM |

    291842 824029HURRAY! can�t balladeer. by virtue of himself by what name highly. 803868

  • Binomo

    9/4/2017 11:26:49 AM |

    345966 881556hey there i stumbled upon your site searching about the web. I wanted to say I enjoy the look of issues about here. Keep it up will save for confident. 429295


    9/10/2017 10:12:25 PM |

    182210 932938A thoughtful insight and concepts I will use on my weblog. You�ve obviously spent a great deal of time on this. Thank you! 854955


    9/11/2017 4:59:02 PM |

    772532 55356I observe there is a lot of spam on this weblog.  Do you need assist cleaning them up?  I may possibly support among classes! 920494

  • Source

    9/11/2017 10:12:07 PM |

    407985 787849Sewing Machines� [...]any time to read or go towards the content material or possibly internet websites we definitely have associated with[...]� 754811

  • dan anton military

    9/13/2017 10:41:36 PM |

    686391 156579Largest lover messages were created to share it along with your and gives honour of the bride and groom. Really sound systems facing unnecessary throngs of people need to take into account each of our valuable concept of all presenting, which is one�s trailer. greatest man toasts 615733

  • 335334 988334Very good post. I previousally to spend alot of my time water skiing and watching sports.  It was quite possible the very best sequence of my past and your content material kind of reminded me of that period of my life.  Cheers 684682

  • teeth implants Boynton Beach

    9/23/2017 10:17:55 PM |

    794107 899395This internet site is actually a walk-through for all of the data you wanted about it and didn�t know who to question. Glimpse here, and you will surely discover it. 350694

  • installment loans for bad credit

    9/24/2017 12:34:56 AM |

    923005 618633This really is a great topic to speak about. Generally when I locate stuff like this I stumble it. This post probably won�t do properly with that crowd. I is going to be confident to submit something else though. 783525

  • see page

    9/25/2017 7:21:43 AM |

    305672 52927Some  truly  good and  utilitarian  information on this  internet site ,  likewise  I think  the  design and style   holds   great  attributes. 285739


    9/25/2017 8:50:46 PM |

    927517 523958All you need to have to know about News details to you. 708952

  • SEO company in chandigarh

    9/27/2017 7:58:25 AM |

    523710 678555Your blog has exactly the same post as yet another author but i like your better.~:;�  180624

  • visit website

    9/27/2017 6:21:17 PM |

    826055 431993You made some decent points there. I looked on the net for any problem and identified most individuals goes in addition to with all your internet site. 193680

  • Bdsm slave training

    9/28/2017 4:01:48 AM |

    507017 715040Amaze! Thank you! I constantly wished to produce in my internet web site a thing like that. Can I take element with the publish to my weblog? 255317


    9/28/2017 1:58:32 PM |

    393215 65001Hey there! Great post! Please  when all could see a follow up! 10275

  • Festivales

    9/28/2017 4:50:31 PM |

    181247 303953I believe one of your commercials caused my internet browser to resize, you may nicely want to put that on your blacklist. 129746

  • mondo sonoro

    9/28/2017 4:50:45 PM |

    926726 194894I think  this internet site    contains some  really  good  information   for everybody : D. 689383

  • Online Html game soccer

    9/28/2017 4:51:05 PM |

    456291 671341The the next time I just read a blog, I truly hope that this doesnt disappoint me approximately brussels. Get real, Yes, it was my option to read, but I truly thought youd have some thing intriguing to say. All I hear is typically a couple of whining about something that you could fix when you werent too busy searching for attention. 312016

  • bad teeth

    9/28/2017 8:07:43 PM |

    766406 322842I�ve just been talking to Sean Gallagher about his upcoming Instant Income Cash Machine course, and he�s been kind enough to fill me in on a couple of details regarding his upcoming course. 421088

  • lowongan kerja kebumen

    9/30/2017 9:20:49 PM |

    129186 47754Some really    select  articles  on this  internet web site , bookmarked . 390012

  • Read Full Report

    10/1/2017 4:00:51 AM |

    759328 867683As I site possessor I believe the content matter here is rattling great , appreciate it for your efforts. You must maintain it up forever! Very best of luck. 503733

  • DMPK

    10/1/2017 9:23:36 PM |

    84355 879525Thank you for the sensible critique. Me and my neighbor were just preparing to do some research on this. We got a grab a book from our location library but I believe I learned more clear from this post. I�m quite glad to see such excellent info being shared freely out there. 160443

  • Empfohlen zu betrachten

    10/5/2017 1:26:08 AM |

    273875 870064I  truly   delighted  to uncover this  internet website  on bing, just what I was  searching  for : D  too   saved to fav. 252576


    10/5/2017 1:28:40 AM |

    196225 705472Locate out these pointers read on and learn to know how to submit an application doing this which you policy your corporation today. alertpay 653064

  • indica

    10/6/2017 10:14:16 PM |

    995296 606373several thanks for telling!. �Truth is normally the very best vindication against slander.� by Abraham Lincoln.. 248562

  • Bandar Judi

    10/7/2017 2:27:06 PM |

    956276 957681Real   instructive and  wonderful   anatomical structure  of  articles , now that�s user  pleasant (:. 349183

  • Orange County Appearance Attorney

    10/7/2017 9:09:56 PM |

    254250 503960I like this blog  extremely significantly so significantly great  information  . 423030

  • porno

    10/9/2017 2:00:05 PM |

    653459 51151This really is such a great resource that you are offering and you provide out at no cost. I appreciate seeing web sites that realize the worth of offering a perfect useful resource completely totally free. I genuinely loved reading your submit. 550517


    10/10/2017 7:13:46 AM |

    360763 284188Thank you a great deal for giving everyone an extraordinarily unique possiblity to check guidelines from here. 294556

  • Bolide

    10/11/2017 4:30:58 PM |

    640797 226415I gotta  favorite this  web site it seems  really beneficial . 967303

  • 大埔忠誠僱傭XX喺黑店

    10/12/2017 5:12:16 PM |

    763122 995201really very good post, i surely really like this internet site, go on it 765915


    10/16/2017 4:17:05 PM |

    685705 201800Excellent post, well put together.  Thanks.  I will likely be back soon to check out for updates. Cheers 706889

  • places to eat in birmingham al

    10/19/2017 12:48:46 AM |

    306950 915109of course like your web-site nevertheless you need to check the spelling on quite several of your posts. Numerous them are rife with spelling issues and I to locate it quite bothersome to inform the reality nevertheless I�ll surely come back again. 679685

  • tv price tracker

    2/25/2018 6:08:51 PM |

    I believe that is one of the most significant information for me. And I’m glad reading your article.I really like this blog, It's always nice when you can not only be informed but also get knowledge, from these type of blog, Thanks.

  • custom essays star writers

    3/11/2018 6:43:21 PM |

    I suppose that this introduction is executable to follow! Thanks for the updated report! I really liked browsing this blog!