Friday, March 25, 2011

Hide List View Tool bar Items

function hideListViewToolbarItems()
var doc = document.getElementsByTagName('ie:menuitem');
for (var i = 0; i < doc.length; i++) {
var itm = doc[i];
if ('OpenInExplorer') != null)
var p = itm.parentNode;


A few thoughts as to why it's not working...

1) Match for part of the text and leave off the "zz33_" as that part can be different for every page.

2) Don't delete the nodes, hide them

3) Make sure your code is loaded after the web part with the View dropdown (i.e. if using a Content Editor Web Part, move it under the list web part)


Thursday, March 24, 2011

Add Web Parts to DispForm, EditForm or NewForm.aspx

One of the users of our SharePoint project asked if it was possible to show an “Item List” on the “View Item” page.

My first reaction was: “Of course it is, add a Web Part displaying the “Item List” to the page and we’re done”.

But when I browsed to the “View Item” page and clicked the “Site Actions” I noticed that there wasn’t an “Edit Page” option available. Strange, but after some -Googling- I found the following sollution:

  • Open IExplorer and navigate to your “View Item” page (DispForm.aspx)
  • Replace everything in the URL after “?ID=#“ with “&PageView=Shared&ToolPaneView=2″ (without the quotes of course) and press
After adding a Web Part to the page and saving it, the “Edit Page” option will be available the next time you click “Site Actions” on that Page.

Document library Views Dropdown to change the View disappeared

When you go to a document library or list in Sharepoint 2007, you see a dropdown in which you can select a different view or create a new view if you have the right permissions.

If you ever find yourself thinking “Where did the change the view dropdown go?”

Change view disappeared

Don’t worry, one of two things could have happened.

  1. You added a second document library webpart on your page, but this would be obvious because you would see two webparts, one with a dropdown and one without it.
  2. Your user (or yourself) -closed- the webpart and added it again, leaving the closed webpart on the page, but hidden. This one is harder to detect, because you only see the webpart without the dropdown.

Close webpart

How do you fix this?

In the first case there isn’t much of a problem, you -delete- the second webpart from the page or you leave it on there (but without the dropdown).

For the second case you’ll have to edit the page (Site Actions, Edit Page), press Add a Web Part. At the bottom of the dialog is a link “Advanced Web Part gallery and options“, click it. A side bar “Add Web Parts” appears. Below the “Select the collection you want to browse.” is a link called “Closed Web Parts“, when you click it the Web Part List with closed Web Parts appears. Select the Document Library Web Part and click the “Add” button on the bottom of the screen. The page will show the two Web Parts, -delete- the one without the dropdown and you’re back in business.

Why? A web part which shows a list is supposed to display only one view of the list at a time. But you can definitely change the view by modifying the shared web part properties.

Useful Parameters to date for WSS 3.0 and MOSS 2007

Back in the days of WSS v2 and SPS 2003, one could use some handy URL parameter passing to edit web pages and browse for or search web parts.

My three favorite parameters for WSS v2 and SPS2003 were:

To Correct or Remove Misbehaving Web Parts

To Open the Page in Web Part Design Mode

To Open the Search Web Part Zone

Now in WSS 3.0 and MOSS 2007 we have the much more practical approach of switching views. Enter the Site Actions Menu, using the menu options we can edit the page, browse to site settings, etc.. But what happens if the Site Actions menu is not visible on the page. Maybe it was missed in the look and feel or has been removed deliberately like I had to do recently for a client. Now why someone would need to remove it and how this can be achieved (in at least two ways) will be covered in a later post.

Here are my favorite parameters to date for WSS 3.0 and MOSS 2007:

To open the Design Bar - Useful for pages in the Pages Library

To turn on Web Part Zone Editing

Note: The Site Actions Menu is rights trimmed and that means not all users can see or use it. Users with limited access or read rights will not be able to make use of the URL\Query String parameters. The parameters are just an alternative to get to the editing\design controls rather then a security bypass.