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

         <webPart xmlns='http://schemas.microsoft.com/WebPart/v3'>
             <type name='Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c'/>
             <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
              <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>

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
var viewId = wpDefinition.Id;

List list = web.Lists.GetByTitle("MyLibrary");
View view = list.Views.GetById(viewId);
view.Toolbar = "<Toolbar Type='None'/>"

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?

1 Answer 1


The webpart doesn't has any property for setting Toolbar Type but the view does. You can use CSS or JSLink (postRender Handler) to remove/hide toolbar.

You CSOM seems to be updating the view in the list/library but not necessarily the view on your page.

  • 1
    Updating the query and viewfields of the view in this manner does work though. Its only the toolbar property that is disregarded
    – Oaden
    Commented Jul 16, 2014 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.