You can take a look at the View Element Schema https://msdn.microsoft.com/en-us/library/office/ms438338.aspx?f=255&MSPPError=-2147217396.
Where you would need to change the list view "Scope" property to "Recursive" in order to get the desired result.
SCOPE - Optional Text. Specifies the recursive scope for a view of a document library. Possible values include the following:
FilesOnly—Show only the files of a specific folder.
Recursive—Show all files of all folders.
RecursiveAll—Show all files and all subfolders of all folders.
If this attribute is not set, the view displays only the files and subfolders of a specific folder. The value of this attribute corresponds to the Scope property of the SPView class.
In C# CSOM code your method should look something like this:
private void CreateView(string[] fields)
{
var lists = _web.Lists;
var existingLists = _context.LoadQuery(lists.Where(x => x.Title == _listName));
_context.ExecuteQuery();
var list = existingLists.FirstOrDefault();
var viewColl = list.Views;
_context.Load(list.Views);
_context.ExecuteQuery();
// Specifies the properties used to create a new list view
var creationInfo = new ViewCreationInformation();
creationInfo.Title = "Flat View";
creationInfo.RowLimit = 100;
creationInfo.ViewFields = fields;
creationInfo.ViewTypeKind = ViewType.None;
creationInfo.SetAsDefaultView = true;
viewColl.Add(creationInfo);
_context.ExecuteQuery();
_context.Load(list.Views);
_context.ExecuteQuery();
var flatView = list.Views.GetByTitle("Flat View");
flatView.Scope = ViewScope.Recursive;
list.Update();
flatView.Update();
_context.ExecuteQuery();
}
The code introduses new view in a list (not optimized for your case) and not optimized as code, but you can get the idea.
the important line is to set the scope
flatView.Scope = ViewScope.Recursive;
and then update the view.