.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

SPSiteDataQuery display no results

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :SharePoint

 In SP 2010 i want retrieve all Documents Libraries with a CAML query

here my code

SPSiteDataQuery q = new SPSiteDataQuery();

 q.Webs = "<Webs Scope='SiteCollection' />";

q.Lists = "<Lists BaseType='1'/>";

q.ViewFields = "<FieldRef Name=\"Title\" />";

DataTable dt = SPContext.Current.Web.GetSiteData(q);


But i doesn't work, return an empty datatable

Where is my mistake?

Thanks in advance


View Complete Post

More Related Resource Links

How to display a count of search results with keywords in a label?


Sorry for a basic post here; I am very new to VB!

I am currently building a search page, which includes a textbox and two drop-down lists, a search button, and a datagrid. If results are found and displayed, I would like a label to display:

(e.g.) "24 results found for 'blue sky clouds' "

...where the integer represents the results count, and the keywords and/or drop-down list selections are included in the string.

If no results are found I would like the label to display:

(e.g.) "No results were found that match your selection. Please try again"

I would also like the label to be invisible until a search occurs.

Thanks in advance!

Search Results Customization - Display Document LibraryTitle Instead of Document Metadata Title

I am running a pretty basic SharePoint 2010 setup that is being used as an intranet for my organization.  This also includes service up internal documents to our users.  Currently, our documents are displayed on various pages using the CQWP and are organized by title as dictated by the document library title.  As part of the search capabilities of this site, I have implemented a basic search page to return results on the documents from this list.  The problem I am running into is that the search results are displaying results based on the metadata title of the actual document instead of the assigned document library title. My questions are this: How do I change the search results so they display based on the document library title? How do I view what columns are currently being crawled by the search capabilities? Thanks in advance for any help you might be able to provide!

How come the same store procedure call can display different results?


Hi all,

This is the sproc I am calling from my Asp.Net application:

ALTER PROCEDURE [Uds].[Dashboard_GetJobs2]
 @date as datetime = null
 Select * From Uds.RealtimeLogging
 Where (@date is null or [timeStamp] > @date)

If I ran from query analyzer I get the correct results:

 exec Uds.Dashboard_GetJobs2 '9/20/2010 11:01:23 PM'

However, if I ran the Asp.Net page, ALL records are showed. Looking at the SQL Profiler I see the following call:
 exec sp_executesql N'exec Uds.Dashboard_GetJobs2',N'@date nvarchar(21)',@date=N'9/20/2010 11:01:23 PM'

And if I ran the statement above in query analyzer it WILL return ALL records. Why????

Thank you


How to return looped procedure results so that they display as multiple rows of a single output inst


I understand that the below fragment will return a separate 1-row results set for each successful loop (also unnecessarily repeating the column header each time). How can I alter my procedure so that each value returned by the loop is appended underneath the previous value as multiple rows of a single results set? Do I have to store each return value in a temp table or someother storage object? It would be nice to just be able to spit them out row by row as each loop returned. Possible? Easy? Hard? I really appreciate the help I've received here so far.

SELECT (whatever)

OPEN techCursor;
FETCH NEXT FROM techCursor INTO @techNumLoop;
EXECUTE pr_FindExpenses4Tech @techNumLoop, @itemCount OUTPUT
SELECT @itemCount Item_Count

Have search results display the filename of a word doc, instead of the Title Metadata


Im currently implementing a campus wide search service, based on MOSS 2007. It obviously indexes a lot of Word documents.

If the word document has no value in its 'Title' metadata (properties of the document) then the filename is displayed in the search results page, and if a title value is present then this is shown instead. However, whoever created our word templates put the value SU_REPORT into the title value of the template and so ALL of our documents now have this in (yes stupid i know!) Nobody every changes these, so we have a lot of docs that when displayed in the search results show a meaningless name of SU_REPORT

So my question is, can  i modify the behaviour of search so that if the title is blank OR the title = "SU_report" then the filename is displayed instead?

I'm guessing that this is done either via the XSLT to control the display in the Core Results WebPart, or maybe it can be done at the metadata level by disconnecting the title property (i'd rather not do this because it is very occasionally useful!)

Any advice greatfully receieved

James Watts

Display All results in ObjectDataSource


I have objectDataSource connected to report viewer.

This datasource have a select method to filter the results by Dep_id parameter

Now if i want to include all results(All Departments) what should i do ???

Display files (where we dont have access to) in Search Results- Sharepoint 2007



Is there a way in which we can make the sharepoint search result display- files where we dont have access to ?

The requirement is that-

There are many files stored in document libraries which are either "Shared" or "Confidential"

Now normally The Confidential documents are not displayed in the search result of sharepoint search. (Since access to those files are denied)


Is There a way in which we make these files appear in the search result ? However when the user clicks on the URL/Title of the file the "Access Denied Page" is displayed (If the user doesnt have access).


This is because we dont want the files (Which are declared confidential) to be re-created.

Site Analytics - how get specific list item id to display in Top Page Results

We have created a new Site to store Knowledgebase Articles. The articles are being added as items in the list. We now want to find which are the most viewed items. When I look at Site Analytics, I find several pages being returned including what I believe are the Items viewed. When I look at the details under the graph or when exported to Excel, this the is extent of the Page URL (/lists/kbarticles/dispform.aspx?...). There are several occurances of this same URl which I expect are separate items that have been viewed. How do I get the ID of the item or other information, so I can track it to the specific Knowledgebase Article? Additional information: I can click on the URl and it will take me to the unique Knowledgebase Article. 

GridView inline Master/Detail record display

This code drop is part of a smash and grab series. If you're in a rush, you can just grab this code and insert it into your application, no understanding is required. When you have some time (ya, right) you may want to review the source code.

Display data in gridview dynamicallay

I have AD domain which has 100000 users, I want to display all the users in gridview controls.Actually it is displaying users in gridview after parsing entire domain which takes around 30 min. I want to display the users while loading itself.It is continously getting user information from AD domain and getting each user details, I want to display the users information which already queried instead of waiting till getting all users information

asp.net display data in gridview

i want to display data in gridview binded to a sql datasource
but the problem part is i want to bind a field of that datasource to a dropdownlist and when a item is selected in that dropdownlist then correcposnding to that data will be displayed in gridview...

display data into GridView from excel sheet

I have to display data from excel sheet into my gridview and also I need to figure out a way to store data into excel files from my web page. I am using C# 3.5, VS 2008.

Display Related Data in an ASP.NET GridView

Typically when you display a datagrid you will want to show data from a related table. There are 3 different ways to accomplish this with NetTiers. You can use a custom stored procedure, deepload functionality from the code behind, or a strongly typed datasource control. We'll provide an example of each

Store and Display Images from MS Access Database Using C#

There is only the difference of coding syntax to stream the binary data of image content type to upload it into MS Access Database using C#/VB in ASP.Net 2.0

Namespaces required:-
using System.Data.OleDb;

OleDb is used to connect the web site forms with MS Access Database using Microsoft.Jet.OLEDB.4.0

divs do not display side by side


I have two divs. I want them to display side by side, on the same row. Using display:inline-block I can do that. But as soon as I position some text in the bottom right corner of div1, the two divs do not have the same vertical position. They are side by side, but the 2nd div starts at the vertical position of the positioned text in the 1st div.   Why would it do that?  Both Chrome and IE8 render it the same way.

( I am doing the nesting of the divs on the left side so that I can position absolutely within a div and not the page. I can't get text to position in the lower right corner of a div any other way. )


  <div style="border:2px solid black;">
    <div style="display:inline-block;">
      <div style="width:10em; height:4em; background:orange;color:White;
        <span style="position:absolute;bottom:0px;right:0px;">
        login message

    <div s

Display column from child table. Possible ?



I'am using dnamic entity with EF4. On a list page of a table, I would like to display a column containing information from a child table of the current element. Sample :

Order List :

Order Data | Required Date | Shipped Date | etc... | ... | Customer Name (foreign key with tostring() method override) | Customer Postal Code (Column that I want to add) |

I don't known how to do that. Is it possible ? Maybe I have to to create my own Metadata proxy that will add dynamicly a column on the MetaColumn list of the table.

Does someone have an easier or better idea ?

Thank you for any help.

Need Syntax To Make Results of LINQ Union Return Non-Generic Type



I have the below SQL which works just fine:

SELECT     Message, CreateDate, AccountId, AlertTypeId
FROM       dbo.Alerts
SELECT     TOP (100) PERCENT Status, CreateDate, AccountId,
                          (SELECT     10 AS Expr1) AS AlertTypeId
FROM         dbo.StatusUpdates
WHERE AccountId = PassedInParameter

I have been going about trying to convert the above into a LINQ method and am having problems with return types.
As the above SQL illustrates, I am querying two distinct LINQ tables - Alerts and StatusUpdates -
and then attempting to perform a Union on them. In order to do the union in LINQ, I have to have agreeing types. So, I
am using "var" to make the results of "alerts" and "updates" generic before the union.  

public IList GetStatusUpdatesAsAlertsByAccountId<T>(Int32 accountId)
            using (WorkbookDataContext dc = _conn.GetCont

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