Monday, 15 July 2013

SharePoint Interview Questions and Answers: SPSiteDataQuery

Download: https://sites.google.com/site/sasivalipireddy/home/SPSiteDataQuery.png 
  1. What are SPQuery and SPSiteDataQuery?
  2. SPSiteDataQuery properties?
  3. Difference between SPQuery and SPSiteDataQuery?
  4. What are the limitations of both?
  5. How the SPQuery and SPSiteDataQuery return?
  6. How to set the row limit to the both?
  7. Searching scope levels of SPQuery and SPSiteDataQuery?
  8. What is the max limit of querying the lists using SPSiteDataQuery?
  9. Is it possible to query the records across the site collection level using SPSiteDataQuery?
  10. What is the default row limit value for the SPQuery?
  11. SPQuery.RowLimit Property?
  12. To Query all Web sites in this site collection?
  13. How to query the specific lists only using SPSiteDataQuery?
  14. Difference between Caml and Linq queries?
  15. How to set the Max lists limit?
  16. what all are Errors you faced while working on SPSiteDataQuery?
  17. I have created a custom list called “Employees” in all the sites in a site collection and have added the data in all the lists. Now I want to query those specific lists only. What is the approach?
  18. How can consider hidden lists also in SPSiteDataQuery?
  19. Is it possible to do joins lists using SPQuery?
  20. How to query with the type: Single line of text, multiline of text, persons or groups, DateTime etc..
  21. How to get the folders and sub folders levels documents from the document library?
  22. How to query specific list using SPSiteDataQuery?

How to query specific list using SPSiteDataQuery?
Query.Lists="    <Lists><List ID=”960BF6F6-F264-4305-B3CB-BDB9BF8F67DF” /></Lists>" – query a specific list  

Using Folder, FilesOnly, Recursive, RecursiveAll in SPquery in SharePoint
 
Joins in SPQuery

SPQuery Quick Guide 
  1. //Query on single line of text:  
  2. <query><where><eq><fieldref name="Title"><value type="Text">SingleLineOfText</value></fieldref></eq></where></query>  
  3.   
  4. //Query on Multiline of text: - note use of [CDATA[] to avoid parsing errors  
  5. <query><where><contains><fieldref name="Body"><value type="Text"><![CDATA[Search Criteria]]></value></fieldref></contains></where></query>  
  6.   
  7. //Query on Person or Group (By Name)  
  8. <query><where><eq><fieldref name="Author"><value type="Text">Sasi Kumar Reddy</value></fieldref></eq></where></query>  
  9.   
  10. //Query on Person or Group (By ID)  
  11. <query><where><eq><fieldref lookupid="TRUE" name="State"><value type="Lookup">4</value></fieldref></eq></where></query>  
  12.   
  13. //Query on SPUser ID  
  14. <query><where><eq><fieldref lookupid="true" name="SlaesPerson">  
  15. <value type="User">7</value> </fieldref></eq></where></query>  
  16.   
  17. //Query on SPUser Name  
  18. <query><where><eq><fieldref name="SalesPerson"><value type="User">john</value></fieldref></eq>   
  19.  </where></query>  
  20.   
  21. //Query on DateTime Only  
  22. <query><where><eq><fieldref name="Created"><value type="DateTime">2012-01-10</value></fieldref></eq></where></query>  
  23.   
  24. //Query on DateTime   
  25. <query><where><eq><fieldref name="Created"><value includetimevalue="TRUE" type="DateTime"><today></today></value></fieldref></eq></where>></query>  
  26.   
  27. //Query on Lookup by text  
  28. <query><where><eq><fieldref name="State"><value type="Lookup">SasiReddy</value></fieldref></eq></where></query>  
  29.   
  30. // Query on Lookup by ID  
  31. <query><where><eq><fieldref lookupid="TRUE" name="State"><value type="Lookup">108</value></fieldref></eq></where></query>  
  32.   
  33. // Query on Today date  
  34. <query><where><eq><fieldref name="Created"><value type="DateTime"><today></today></value></fieldref></eq></where></query>  
  35.   
  36. // Query on last week  
  37. <query><where><eq><fieldref name="Created"><value type="DateTime"><today offsetdays="-7"></today></value></fieldref></eq></where></query>  
  38.   
  39. //Query to return only empty columns,   
  40. query.ViewFields="<fieldref name="Description" nullable="TRUE">";    
  41. </fieldref>  
Best Reference:

No comments:

Post a Comment