If you have ever wondered whether you can use SharePoint Search functionality within an InfoPath browser form to search for documents on a SharePoint site or in a specific document or form library, the answer is "Yes", and recipe 61 will show you how to do this.

Here I'm in SharePoint 2010 Central Administration, and as you can see, I've already created a search scope called FormLibraries, which my InfoPath form will use to search for InfoPath forms located in this form library, a form library called FormsLib.

If we take a moment to go through a couple of the InfoPath forms in the FormsLib form library, you'll see that the InfoPath form is a simple form that has a text box control on it.

I currently have form 3 open and as you can see the text "InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010" has been entered into the text box control. Form 4 contains the name of the form itself. Form 5 contains the sentence "The color of Microsoft InfoPath is purple. Would you not agree?" Form 6 contains my name. And all of the other forms contain the name of the form itself.

I've already published the InfoPath form that performs the SharePoint Search within the FormsLib form library to SharePoint, so I'll click on Add document. When the form opens, I'll first search for all of the forms in the form library by typing in a "*" and clicking Find. This should return all of the InfoPath forms in the form library. I can click on Fetch Next and Fetch Previous to navigate through the search results.

If I wanted to find a form based on its name, I could type in its name, for example form03.xml. And that should return form03.xml.

But I could also search for specific text within the InfoPath form, for instance part of my name. And that should return the form that contains my name. If I open the form in InfoPath Filler 2010, my name should be listed.

And I could also search on part of a sentence. One of the forms contained the sentence "The color of Microsoft InfoPath", so "color of Microsoft InfoPath", and click on Find. And that should return the form that contains part of that sentence. And that is the case.

So this InfoPath browser form that performs a SharePoint Search does not only look for documents based on their name, but can also find documents that contain certain text within the documents themselves.

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced
in any way without an expressed written consent. The techniques
demonstrated in this article may be used within any Microsoft InfoPath project.
This article is provided without any warranties. Copyright for this article is
non-transferrable and remains with the author.