Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8328191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:21:32+00:00 2026-06-09T01:21:32+00:00

I’m trying to query the sharepoint search with the following code protected ResultTable Search(String

  • 0

I’m trying to query the sharepoint search with the following code

    protected ResultTable Search(String query, SPWeb currentWeb)
    {
        ResultTable rt = null;

        try
        {
            FullTextSqlQuery q = GetFullTextSqlQuery(currentWeb);

            q.QueryText = query;

            q.RowLimit = int.MaxValue;
            rt = ((ResultTableCollection)q.Execute())[ResultType.RelevantResults];
            //q.Dispose();

        }
        catch (Exception ex)
        {
            rt = null;
            Logging.LogException(ex);
        }

        return rt;
    }

    /// <summary>
    /// Create base FullTextSqlQuery
    /// </summary>
    /// <returns>FullTextSqlQuery</returns>
    protected static FullTextSqlQuery GetFullTextSqlQuery(SPWeb currentWeb)
    {
        FullTextSqlQuery q = new FullTextSqlQuery(currentWeb.Site);

        q.Culture = new CultureInfo(1033);

        q.EnableStemming = false;
        q.TrimDuplicates = true;

        if (SPSecurity.AuthenticationMode != System.Web.Configuration.AuthenticationMode.Windows)
        {
            q.AuthenticationType = QueryAuthenticationType.PluggableAuthenticatedQuery;
        }
        else
        {
            q.AuthenticationType = QueryAuthenticationType.NtAuthenticatedQuery;
        }

        q.RowLimit = 200;

        q.StartRow = 0;
        q.IgnoreAllNoiseQuery = false;
        q.ResultTypes = ResultType.RelevantResults;

        return q;

    }

And no matter what i do i get this exception: Exception from HRESULT: 0x80040E01

23-07-2012 14:53:45 Documenten Search System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail] Exception from HRESULT: 0x80040E01

Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Office.Server.Search.Query.ISearchQueryServiceApplication.Execute(QueryProperties properties)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.<>c_DisplayClass4.b_3(ISearchServiceApplication serviceApplication)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoSpLoadBalancedUriWsOp[T](WebServiceBackedOperation1 webServiceCall, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, String operationName)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoWebServiceBackedOperation[T](String operationName, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, WebServiceBackedOperation
1 webServiceCall)
at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.Execute(QueryProperties properties)
at Microsoft.Office.Server.Search.Query.Query.Execute()
at Rapportages.RapportageDocumenten.RapportageDocumenten.Search(String query, SPWeb currentWeb)

I read suggestions i should reduce the rowlimit, but i get this exception even with a rowlimit as low as 20.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:21:33+00:00Added an answer on June 9, 2026 at 1:21 am

    Putting the fulltextsqlquery in a using fixed the issue. Don’t ask me why.

                       using (FullTextSqlQuery q = GetFullTextSqlQuery(web))
                        {
                            q.QueryText = sqlQuery.ToString();
                            rt = ((ResultTableCollection)q.Execute())[ResultType.RelevantResults];
                            Logging.LogMessage(rt.RowCount.ToString());
                        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.