I am adding a new view to a list using CSOM (ViewTypeKind
= Grid
).
The same code works perfectly for other types of views.
For datasheet views, although they are added and they function properly, they are only available in the ribbon dropdown, not in the page context menu view selector.
The fact that other people are experiencing this makes me suspect of an issue in the API but perhaps there is something we can do to overcome this.
Adding the view manually through the UI works fine.
Similar thread:
List views of type Datasheet created in CSOM do not appear in the list's 'view selector'
About the View Selector (aka ClientPivotControl):
List View Web part not showing all available views for list
EDIT:
Here's a basic example in case anyone wants to give it a try.
BTW, it appears that this issue is not limited to CSOM. It happens the same when adding datasheet views from the server side.
param(
$webUrl = "http://yourwebsite",
$listTitle = "yourlisttitle",
$viewTitle = "datasheet-test"
)
$web = get-spweb $webUrl
$list = $web.Lists[$listTitle]
$view = $list.Views.Add($viewTitle, "Name", "", 50, $true, $false, "GRID", $false)