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 folder
if query.ViewAttributes="Scope=\"RecursiveAll\" then it will return all items within folder and subfolder including folders