locked
Set web part view to full tool bar using site definition RRS feed

  • Question

  • Hi

    I have site definition which I use to provision few pages and web parts. After the site is provisioned i see web part coming with summary tool bar. Instead I would like to have standard tool bar.

    Is it possible to change the toolbar type from summary to standard tool bar while provisioning site using site definition?

    Reegards,

    RK


    Radhakrishna
    • Moved by Mike Walsh FIN Saturday, July 23, 2011 5:07 PM site definition question (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    Saturday, July 23, 2011 4:55 PM

Answers

All replies

  • Hi ,

     

    There are three types of tool bar :Standard ,Freeform and none .You probably have set the <Toolbar Type="Freeform" /> .Find this line in your .xml file and change the type to standard.

     

    For detailed information ,please refer to this site:

    SharePoint Schema.xml, Onet.xml and Toolbar Type: http://blog.qumsieh.ca/2010/09/01/sharepoint-2010-schema-xml-onet-xml-and-toolbar-type/

     

    Thanks,


    Entan Ming
    Wednesday, July 27, 2011 3:18 AM
    Moderator
  • Hi Entan Ming,

    I tried the method mentioned in above link and also tried options mentioned in

    http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/96aac2dd-29fc-4e63-8730-9d1adc01b826 

    http://oriolfm-blogs.itequia.com/2010/03/removing-listview-webpart-toolbar.html 

    https://sladescross.wordpress.com/category/list-view-web-part-toolbar-settings/

    but i was not able set thte tool bar correctly. I am not able to understand if Web part manager is not refreshed. Anyways, I got this to work by removing the XML code from Site definition and adding the web parts directly to the page as below.

    SPFile objFile = objWeb.GetFile("CorePages/NewsandInformation.aspx");

     

    if (objFile.CheckOutStatus == SPFile.SPCheckOutStatus.None)

    {

     objFile.CheckOut();

    }

    SPList oList = objWeb.Lists["Newsletters"];

    // Instantiate the web part

    ListViewWebPart wpart = new ListViewWebPart();

    wpart.ZoneID = "Left";

    wpart.ListName = oList.ID.ToString("B").ToUpper();

    wpart.ViewGuid = oList.DefaultView.ID.ToString("B").ToUpper();

     

    // Get the web part collection

    SPWebPartCollection coll =

    objWeb.GetWebPartCollection("CorePages/NewsandInformation.aspx",Storage.Shared);

    // Add the web part

    coll.Add(wpart);

    CreateRSSWebPart(objSite, objWeb);

    objFile.CheckIn("ok");

     

    Hopefully this helps someone stuck with same issue.

    Regards,

    RK 


    Radhakrishna
    • Marked as answer by Emir Liu Monday, August 1, 2011 1:46 AM
    Wednesday, July 27, 2011 4:30 PM
  • Hi Radhakrisshna,

    Thanks for sharing the solution to all of the forum members, that would be helpful to some else who have the same issue with you .

    Best regards,


    Entan Ming
    Monday, August 1, 2011 1:35 AM
    Moderator