I created a custom page for executing KeywordQuery with SearchExecutor. I am getting results back but want to display the ResultTable from those results in the OTB SharePoint Search page. I don't want to have to parse each field of the table to make it look like standard SharePoint Results page results. Is there a webpart I can bind to that will automatically display the results.

Below is my code for a custom page in SharePoint. I am trying to display the results from that query in either the Search results page or make the output look like the sharepoint results page.

if (Page.IsPostBack) {

        KeywordQuery keywordQuery = new KeywordQuery(SPContext.Current.Site);
        keywordQuery.QueryText = searchbox.Text;

        keywordQuery.ResultsProvider = SearchProvider.Default;

        //keywordQuery.ResultTypes = ResultType.RelevantResults;
        keywordQuery.KeywordInclusion = KeywordInclusion.AnyKeyword;

        keywordQuery.ResultsUrl = "https://w12r2-sp16/_layouts/15/osssearchresults.aspx";

        keywordQuery.Timeout = 60000;

        keywordQuery.IsCachable = true;
        //keywordQuery.IgnoreSafeQueryPropertiesTemplateUrl = true;

        SearchExecutor searchExecutor = new SearchExecutor();

        var resultTableCollection = searchExecutor.ExecuteQuery(keywordQuery);

        ResultTable resultTable = resultTableCollection.FirstOrDefault();

        dataTable = resultTable.Table;


1 Answer 1


What do you mean "bind to that will automatically display the results"?

If you want to display content on your SharePoint classic pages by configuring simple and advanced queries, we could use Content Search Web Part.

For more information, please refer to:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.