I recently successfully added a web-part to the frontpage using the method from Add Document Library XsltListViewWebPart using CSOM or web services
However, it seems impossible to disable the toolbar of this webpart. I have tried adding it to the webpart properties like
<webParts>
<webPart xmlns='http://schemas.microsoft.com/WebPart/v3'>
<metaData>
<type name='Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'/>
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name='DisableViewSelectorMenu' type='boolean'>true</property>
<property name='InplaceSearchEnabled' type='boolean'>false</property>
<property name='ListUrl' type='string'>ProjectInfo</property>
<property name='Toolbar Type' type ='string'>None</property>
<property name='MissingAssembly' type='string'>Cannot import this Web Part.</property>
</properties>
</data>
</webPart>
</webParts>
Or through the code using
WebPart importingWebPart = mgr.ImportWebPart(webPartXml).WebPart; // take webPartXml from above
WebPartDefinition wpDefinition = mgr.AddWebPart(importingWebPart, "Top", 1);
mgr.Context.Load(wpDefinition,d => d.Id); // Id of the hidden view which gets automatically created
mgr.Context.ExecuteQuery();
var viewId = wpDefinition.Id;
List list = web.Lists.GetByTitle("MyLibrary");
View view = list.Views.GetById(viewId);
view.Toolbar = "<Toolbar Type='None'/>"
view.Update();
web.Context.ExecuteQuery();
But nothing works, it keeps happily displaying the toolbar. Yet if i try set the toolbar of a normal view this way, it works instantly.
[Edit] It should be noted that i can modify all other settings of the view this way, just not the toolbar. I can sort, order, add viewfields
Does anyone have a solution?