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.
Using RecursiveAll in SPQuery
- SPQuery Q = new SPQuery();
- Q.Query = "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>BOOK</Value></Eq></Where>";
- Q.ViewFields = "<FieldRef Name='Name' /><FieldRef Name='ID' />";
- 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.
Tidak ada komentar:
Posting Komentar
[give me your ideas, hopes, comments and compliments below...]
[aaand...... +1 if you need to....]