Hello All,
I am using a publishing site and provisioning an Announcement List.
My requirement is to make the Toolbar Type to "No Toolbar" - "None" using Xml or programmatically.
Within the Schema.Xml I have tried to set the Toolbar Type to None however not working.
Also using code set the Type Attributes to "None" but same thing...not working - When the list is provisioned, I noticed that on the List Web Part Properties, the Toolbar Type is set to No Toolbar but is seems not applying to the list unless I click on the apply button.
The final trial was to set the Type Attributes to "Standard" which shows in the Web Part Properties as a Full but behaving as a "No Toolbar".
Any clue guys ?
if (webPart is Microsoft.SharePoint.WebPartPages.ListViewWebPart) { Guid webPartGuid = new Guid(((Microsoft.SharePoint.WebPartPages.ListViewWebPart)webPart).ViewGuid); SPView view = web.Lists[listName].Views[webPartGuid]; Type viewType = view.GetType(); XmlNode toolbarNode = viewType.InvokeMember("GetNodeFromXmlDom", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, view, new object[] { "Toolbar" }) as XmlNode; toolbarNode.Attributes["Type"].Value = "None"; view.Update(); }