Solved

Moss2007 toolbars in SharePoint 2010 for all sites

Posted on 2013-05-22
1
231 Views
Last Modified: 2013-05-29
I am trying to get the moss 2007 toolbars on document libraries across the whole site but its letting me do it one library/list at a time. I basically go to edit page > edit webpart > show toolbar in the menu.

Is there a way to enable all of them at once in a site?

Thanks!
R
0
Comment
Question by:rsurya23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
kukdai earned 150 total points
ID: 39187705
you can write code for this may be by writing a feature or a utitlity.


here is the code

Open in new window

Addlisttoolbartolist(spweb web,splimitedwebpartmanager wmanager, xmlElement element, string listtitle)
{
system.web.ui.webcontrols.webparts. webpart documentswebpart= (from system.web.ui.webcontrols.webparts.webpart wp in wmanager.webparts where wp.title==listtitle select wp).firstordefault();

if(documentswebpart!=null)
{
changelisttoolwebpart(documentwebpart);
}


}


this is the function where you pass the webpart object.
changelisttoolwebpart(system.web.ui.webcontrols.webparts.webpart wp)
{
if (wp is XsltListViewWebPart)

                     {

                           XsltListViewWebPart lvwp = (XsltListViewWebPart)wp;

 

                           BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;

 

                           MethodInfo ensureViewMethod = lvwp.GetType().GetMethod("EnsureView",  flags);   

        

                           object[] ensureViewParams = { };

                           ensureViewMethod.Invoke(lvwp, ensureViewParams);

                           FieldInfo viewFieldInfo = lvwp.GetType().GetField("view", flags);

                           SPView view = viewFieldInfo.GetValue(lvwp) as SPView;

                           Type[] toolbarMethodParamTypes = { Type.GetType("System.String") };

                           MethodInfo setToolbarTypeMethod = view.GetType().GetMethod("SetToolbarType",

                                                                                                                                  flags, null,

                                                                                                                                  toolbarMethodParamTypes, null);

                           object[] setToolbarParam = { "ShowToolbar" };

                           setToolbarTypeMethod.Invoke(view, setToolbarParam);

                           view.Update();

                     }


}


}

Open in new window


these above two function can be used to solve your problems it is up to you how you want to use them...
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
The vision: A MegaMenu for a SharePoint portal home page The mission: Make it easy to maintain. Allow rich content and sub headers as well as standard links. Factor in frequent changes without involving developers or a lengthy Dev/Test/Prod rel…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question