Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I make a web service that uses the object model of SharePoint 2007 to search Documents?

0
Posted

How do I make a web service that uses the object model of SharePoint 2007 to search Documents?

0

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

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123