21 Okt 2011

Get All Items including inside SharePoint Folder Programmatically using SPQuery

Just sharing the knowledge, I want to share about how to get all items / documents programmatically without getting inside the folder and querying it again. So, without folders, all items whether inside a folder or not, will be shown upon your query result.

Awwww, I’m not in Windows 2008 mode to copy my code in here and show some screenshots, but that’s just fine Smile with tongue out.

Using RecursiveAll in SPQuery
  1. SPQuery Q = new SPQuery();
  2. Q.Query = "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>BOOK</Value></Eq></Where>";
  3. Q.ViewFields = "<FieldRef Name='Name' /><FieldRef Name='ID' />";
  4. Q.ViewAttributes = "Scope='RecursiveAll'";

After you code your query, then you can add ViewAttributes and add Scope=’RecursiveAll’ to the SPQuery object.

Done, and all items whether inside a folder or not, will be shown upon your query result.

18 Okt 2011

Tools to Get SPSite and SPWeb Aggregation ID for SharePoint 2010

It’s been a busy months for me, I can’t write anything on my spare time. But I tell you what, I’ve created a little tools to generate Aggregation ID so you don’t have to write code about it if you just want to query the Web Analytics on SharePoint 2010.

Just specify your URL and Level, and you’re good to go.


Rdz.GetAggregationId.exe –URL <URL of SharePoint Site or SubSite> –Level [SPSite | SPWeb]

Below is the exe file that you can use. It based on .NET 3.5.

UPDATE: Thanks for Anand for noticing. I just realized that I haven’t include the DLL inside the ZIP file yet. Above, is the updated link. Thanks a lot and sorry for my mistake! Open-mouthed smile