Stefan Pienaar
I would love to change the world, but they won't give me the source code

COMException when using FullTextSqlQuery

December 8, 2011 15:24 by StefanPienaar

SharePoint blows my mind sometimes, and not in a good way.

One of the projects I'm working on which is a windows application gives the user the ability to perform a search on a SharePoint document library which utilizes the FullTextSqlQuery object. The client application builds the query text based on some user input and then passes it to a custom web service which executes the FullTextSqlQuery using the passed query text.

Everything seemed to work perfectly until we started getting the following COMException whenever a search was performed which would return some results:

"Error HRESULT E_FAIL has been returned from a call to a COM component"

I couldn't find any details relating to the error in either the SharePoint logs or the Event Viewer, I guess Microsoft likes to keep us guessing. 

After wasting a couple of precious hours trying to figure out what's actually happening, I stumbled across this forum post which suggests that you add an Order By clause to your query text. Lo and behold, it worked!


Categories: SharePoint (2010)
Actions: E-mail | Permalink | Comments (0)