5
Reply

Q. What is query.ViewAttributes OR How can you force SPQuery to return results from all the folders of the list?

Sagar Pardeshi

Sagar Pardeshi

9y
2.3k
0
Reply

    Hello. you need to specify the scope under ViewAttributes of query. ex query.ViewAttributes="Scope=\"Recursive\"";

    query.ViewAttributes="Scope=\"RecursiveAll\"

    ViewAttributes is used to define scope to return items.if query.ViewAttributes="Scope=\"Recursive\" then it will return all items within folder and subfolder excluding folder, it will exclude folder but can retrieve items from that folderif query.ViewAttributes="Scope=\"RecursiveAll\" then it will return all items within folder and subfolder including folders

    spquery.viewatributes="scope="/recursive/""

    If you use SPQuery on any SPlist .. it will bring back results from the current folder only. If you want to get results from all the folders in the list.. then you need to specify the scope of the query by the use of ViewAttributes.. e.g. query.ViewAttributes = "Scope=\"Recursive\"";