How do I make a web service that uses the object model of SharePoint 2007 to search Documents?
Tuesday, June 26, 2007 3:15 PMhusseiny 0Sign In to Vote Hi all, im new to use SharePoint I would like to make a webService that uses the object model of the sharePoint 2007 to search Documents in a particulart site or in a particular DocumentLibrary. when i use the UI of the sharePoint i found results but by code i tried the following but fails to get any result public class SearchMOSS { public static string SearchSite(string siteURL, string keyword) // SiteUrl Like http://[ServerName]/sites/[SiteName] { try { SPSite site = new SPSite(siteURL); site.OpenWeb(); KeywordQuery queryRequest = new KeywordQuery(site); queryRequest.QueryText = keyword; queryRequest.AuthenticationType = QueryAuthenticationType.NtAuthenticatedQuery; ResultTableCollection resultTables = queryRequest.Execute(); if (resultTables.Count > 0) { ResultTable relevantResults = resultTables[ResultType.RelevantResults]; DataTable dtResults = new DataTable(); dtResults.Load(relevantResults, LoadOption.OverwriteChanges); Dat