.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

FullTextSqlQuery in SharePoint returns zero rows

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :C#

Need to make a custom people picker in my custom web application that will be hosted on SharePoint.  To populate my search, I am making an AJAX call to a web service running the following code:





using (SPSite oSite = new SPSite(

View Complete Post

More Related Resource Links

FullTextSqlQuery returns the right number of rows, but they have no data!


Hey all,

I'm running my first fulltextsqquery, using the function below - it seems to all execute fine and 24 rows get returned (query below) which sounds about right for all the people on my site. What's weird though is that all the columns in the results are empty string ("" or {}) - they definitely aren't empty in the user's profile - can anyone help me? Preferred email is a custom field and is mapped onto a People:PreferredEmail(Text) property in search admin - anything else i need to do?

 string query = string.Format("SELECT {0},{1} FROM SCOPE() WHERE \"scope\"='People'""PreferredEmail", "FirstName");
 public static ResultTableCollection RunFullTextSqlQuery(string sql, int rowLimit)

Resume SharePoint Services Web Application and returns code 1387 error


Hello everyone! Newbie here. I would like to ask how to start the SharePoint Services Web Application on (WSS3.0,internal database, stanalone users) without getting error 1387 ?

I would love to provide more information regarding this issue but what I got is error 1387 displayed in the browser.

I look forward to seeing you guys feedback from your expertise angle.



Microsoft.SharePoint.Client.File.OpenBinaryDirect - returns a 404 error if the file being requested

Hopefully someone can help with this. I'm using Sharepoint 2010. On the server I have manually created a folder in the "Shared Documents" folder called "bin" and uploaded a file into this folder If I attempt to access the files in this folder using the Microsoft.SharePoint.Client.File.OpenBinaryDirect function,  I receive the following error: A first chance exception of type 'System.Net.WebException' occurred in System.dll: System.Net.WebException: The remote server returned an error: (404) Not Found.    at System.Net.HttpWebRequest.GetResponse()    at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()    at Microsoft.SharePoint.Client.File.OpenBinaryDirect(ClientContext context, String serverRelativeUrl). Any other files in any other folders under the shared documents folder are accessible. Here is my example code: ClientContext clientCTX = new ClientContext(SPURL);             //Pass the credentials to the client context             clientCTX.Credentials = credentials;             List DeployFilesList = clientCTX.Web.Lists.GetByTitle("Shared Documents");             CamlQuery caml

SharePoint Search returns wrong date

Hi i am running a Sharepoint 2010 enterprise search indexing a file folder structure with emails(.eml) and attachments(.doc(x), pdf, xls(x), ...). The search results shows a date like first full index time or something like that, but not the date of file creation or any other attributes of the file. My questions: - what may be the reason of the wrong date? - is there a possibility use another attribute for displaying that is more relevante? Please help Kind regards Werner Durrer    

FullTextSqlQuery unexpected result ( Sharepoint 2010 Foundation )

Hello All,I am trying write webpart related with search functionality in sharepoint and FullTextSqlQuery returns unexprected result. I couldn't understand why. In following code I am expecting results for default sharepoint ( sharepoint:80 ) website but it returns cental administration site search results.DataTable resultDataTable = new DataTable();FullTextSqlQuery FTQ = new FullTextSqlQuery(SPContext.Current.Site);FTQ.ResultTypes = ResultType.RelevantResults;FTQ.QueryText = "SELECT FileExtension, ContentClass, IsDocument, rank, title, path, author from scope() ";     ResultTableCollection resultTableCollection = FTQ.Execute();ResultTable resultTable = resultTableCollection[ResultType.RelevantResults];resultDataTable.Load(resultTable);In resultDataTable (path column) all rows related with Centeral Administration site. So, do you have any idea why?PS: I have tried following way to make sure it is runing on default web site;insted of "new FullTextSqlQuery(SPContext.Current.Site);", I put "new FullTextSqlQuery(new SPSite(http://sharepoint:80));" but result is same.  

SharePoint Search Server 2010 Express returns no search results for non-admin users

This is going to sound crazy, but anyway... bare with me... I have a SharePoint Search Server 2010 Express (RTM) installed with a crawl account (call it sharepoint_crawl) which has full read permission to an entire site collection of 100,000 documents. I have logged in with this account to make sure it has read access to everything, and it does. I run a full crawl of all documents and allow it to finish. If I try and search the content for an extremely common term (i.e. 50,000+ hits) I get no results. However, if I log in with a site collection admin I do get search results. There are no indexing errors or query errors in either log files or event log. Everything looks like it is working correctly - just no results for non-admins Anyone tripped on this? I have recreated the crawl account and perform a full re-index with the same results. What gets me is that the crawl account does have read permission to the content it is indexing, the content is indexed correctly, but the crawl account cannot get results back. It is as if security-trimming is removing everything. Any ideas?

How to search documents from the particular document library using FullTextSqlQuery in sharepoint?

Hi, I want search (wildcard search) the document from the particular document library using FullTextSqlQuery class. Thanks Srikanth Reddy

Searching a NVarChar Column with multiple wildcards returns all rows

I'm building a stored procedure to return a set of records, yes nothing big. The column is an NVarchar column and I'm using a select statement of Select * from Table1 where Column1 Like @Column1 Table is currently one record containing the words:  ***Some Test Word***  Is my test word I've set the value of @Column1 to: Some - no records returned Some% - no records returned %Some% - 1 record returned  % - 1 record returned *% - no records returned %*% - 1 record returned %Not Here% - 1 record returned   Can someone tell me why if I have a leading and trailing wildcard I will get all records returned?  Does it have something to do with the '*' characters in the field because some of my users are using these characters. I've also tried changing the select to: where RTRIM(Column1) Like @Column1 with the same result and where RTRIM(Column1) Like N'%' + @Column1 with the same result   What way should I give a user the way to search for a substring inside of an NVarchar field? Oh, I tried using the Substring function and got the same result. Thanks Mike    

Sharepoint 2010 FullTextSqlQuery query problem with where condition

Hello, i´m developing a webpart under Sharepoint 2010, i need to launch some different query´s to filter data but i´m having problems. First of all, i launch this query and i get all the users; SELECT PreferredName, LastName, Department, OfficeNumber, JobTitle, WorkEmail, PictureUrl FROM Scope() WHERE ("scope" = 'Personas') ORDER BY "Rank" DESC with that results i fill different dropdownlist with each of the columns, then I can filter for each column. For example: I filter by PreferredName, Lastname or WorkEmail, with this query SELECT PreferredName, LastName, Department, OfficeNumber, JobTitle, WorkEmail, PictureUrl FROM Scope() WHERE ("scope" = 'Personas') AND (("LastName" Like '%MOSS%')) ORDER BY "Rank" DESC But when i try to use the columns Department, OfficeNumber and Jobtitle every query returns 0 rows. SELECT PreferredName, LastName, Department, OfficeNumber, JobTitle, WorkEmail, PictureUrl FROM Scope() WHERE ("scope" = 'Personas') AND (("Department" Like '%Dirección%')) ORDER BY "Rank" DESC The main thing is if i get all the data i see that these columns (officeNumber, Jobtitle, Department) are not empty. Some of them have values some of them don´t. All the columns have the property "Reduce storage recquirement for text propert

FullTextSqlQuery with Like returns no results

I have a problem with FullTextSqlQuery.  First I made sure I am using Office.Server.Search as you can see from the code below.  I have written the full namespace just to be sure :) Microsoft.Office.Server.Search.Query.FullTextSqlQuery myQueryFull = new Microsoft.Office.Server.Search.Query.FullTextSqlQuery(thisWeb.Site); Running this query it returns all the items in my custom list and scope - so far so good. myQueryFull.QueryText = "SELECT Title, Path,Description,Write,Rank,Size FROM SCOPE() WHERE \"scope\" = 'Car List Definition'"; The following also works fine and filters the elements correctly. myQueryFull.QueryText = "SELECT Title FROM SCOPE() WHERE \"scope\" = 'Car List Definition' AND FREETEXT('Toy*')" ;       BUT BUT BUT, the following returns empty list.  The same if I use Contains instead. myQueryFull.QueryText = "SELECT Title FROM SCOPE() WHERE \"scope\" = 'Car List Definition' AND Title LIKE '%Toy%'";       Any idea what's wrong? I am using sharepoint 2010. Thanks

asp:Button inside a SharePoint Dataview's Rows with onclick event does not call C# function. Pull i

asp:Button inside SharePoint Dataview Rows with onclick event does not call C# function. Pull it out of Dataview and works fine. I have a ASP.NET Button I've placed inside a SharePoint  DataView's rows with an onclick event pointing to C# function block inside my page. The page refreshes when I click on them, but it's not hitting that code block. If I move the button to outside the dataview and make the ID fixed, the code works beautifully. what's up with that? the button in the Dataview: td class="ms-vb" style="width: 70px"><asp:Button runat="server" Text="Delete" id="Delete{@ID}" CommandArgument="{@FileRef}" OnClick="DeleteDoc"/> </td> my C# onclick handler (inline C# on the page) void DeleteDoc(object sender, EventArgs e) { Button b = sender as Button; .. more code The buttons are rendered and they look like this: input type="submit" name="ctl00$PlaceHolderMain$g_08acadfd_957b_4112_a426_cc7c81991c1e$Delete1" value="Delete" id="ctl00_PlaceHolderMain_g_08acadfd_957b_4112_a426_cc7c81991c1e_Delete1" Thie code block in inline and I'm working from SharePoint Designer. Not sure how I can troubleshoot this.  Am I missing something here, maybe I need to add an Itemtemplate or something like we need to in the ASP.N

Need advice on preformance (web service returns list items on 20000 rows list)

Greetings I need to write a web service that will return sharepoint list items (default web services of sharepoint are no use to me since they just suck when the site is not in english).  Since we have lists with 20k+ items, the return xml might get large. Query web service did manage to do it, yet it took some time to output the xml with those 20k rows.  I am affraid that my custom made web service will preform poorly since it wont be "native" to sharepoint. I am asking for your judgement, did i fell into common pitfalls or something or is there any way to improve preformance of my code? My own web service code looks like this:   [WebMethod] public XmlDocument GetListItems(string siteurl, string listguid,string querytext,string rowlimit) { InitSchemaExporter(siteurl); SPQuery query = new SPQuery(); query.RowLimit = rowlimit.Length==0?10:Convert.ToUInt32(rowlimit); query.Query=querytext; return SchemaExporter.GetListItems(listguid, query); } public void InitSchemaExporter(string siteurl) { SchemaExporter.SetSite(siteurl); SchemaExporter.IgnoreField = ConfigurationSettings.AppSettings["IgnoreField"].Split(new string[1] { "\r\n" }, System.StringSplitOptions.None).ToList<string>(); ; SchemaExporter.IgnoreList = ConfigurationSettings.AppSettings["IgnoreList"].Split(new string[

SharePoint Search returns all where user dont have access

Hi, There are around 10 divisional sites and home page in my MOSS 2007 configured with Search feature. The divisional users complained that all the documents are visible to all users, which is not supposed to be. How to restrict the Search based on the user access? Regards Sanra

Query returns correct rows but I am not able to concatenate the rows into a variable :(


Hi all,

Why in the code below I am able to list all rows and display the field 'stepID' but I am not able to concatenate them all in the variable @stepIds?

declare @date as datetime
set @date = '2010-09-20 23:01:20:000'
declare @instance as uniqueidentifier
set @instance = '04658F34-CBF1-4CCD-A683-F23BDB669D35'

  Declare @CrLf char(2)
  Set @CrLf = Char(13) + Char(10)
	Declare @stepIds varchar(8000)
	Set @stepIds = ''
		--@stepIds = @stepIds + ' - Step: ' + CONVERT(varchar(4), stepID)

Downloading a document from a sharepoint site to local file system, copy web service returns null

Hi Guys,
               I am trying to get this done for the last 2 days and I am still banging my head to the wall.
All I need to do is to download files from my sharepoint site library that uses integrated windows authentication. I was using copy webservice : getItem method to accomplish this.

CopyService.GetItem(copySource, out myFieldInfoArray, out myByteArray);

Problem : myByteArray is always returned as NULL

Note: I have tried the same with another site that uses forms authentication but the result was the same (NULL !!)

This is my code:


Copy copy = new CopyService.Copy();


GetRoleCollectionFromUser() returns "User Not Found" 0x80131600 in Sharepoint 2007



I am using GetUserCollectionFromSite() to get the list of users for a site, and with the same list i am calling
GetRoleCollectionFromUser() using login Name i got from previous method. The method is returning a "User Not found" 0x80131600 error. I am the site collection admin for this site and even if i hard code my login name as Domain\UserName(NT ID in this case) i get this error. Please help.

This is in Sharepoint 2007



SharePoint 2010 CMIS Repository Web Service returns site collection repositories

Hi. Recently configured the 2010 CMIS Producer for a SharePoint Site Collection. I have enabled the Producer at each site under the collection e.g.
 CaseManager (Master Site)
   Europe (Sub Site)
   Asia (Sub Site)
If I configure the CMIS repository service URL as http://CaseManager/_vit_bin/cmis/SOAP/
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend