Tuesday, July 22, 2008

Removing single file upload menu from MOSS Toolbar

Hi All,

I am not too sure about the scenario that you may need. But just for a fun purpose i though if we have multiple file upload menu then what to do with single file upload menu, anyways you can upload the single file with multiple file upload menu.

I though let me hide that manu just for a fun purpose.

(1) Add content editor webpart on AllItems.aspx of your document library.
(3) Open Source editor
(4) Paste the following lines of code and see, your single upload will get disabled

<script type="text/javascript">
function GetElementByText(tagName, title)
{
var a = document.getElementsByTagName(tagName);

for (var i=0; i < a.length; i++)
{
if (a[i].text)
{
if (a[i].text === title)
{
return a[i];
}
}
}

return null;
}

if (window.onload)
{
var oLoad = window.onload;
window.onload = function bodyLoad()
{
oLoad();

var o = GetElementByText("ie:menuitem","Upload Document");
if (o)
{
o.disabled = true;
}
}
}
</script>

That's it. Your job is done.

Thanks for the wonderful idea shared at this link

7 comments:

Lost in thought... said...

Loved this. Thanks!

One comment. While this disabled the Upload option, it is still visible though grayed out. I'd love to know how to remove / hide the entire upload button on the web part toolbar.

Jayesh Prajapati said...

Hi,
is it ok with you if we provide same solution using jQuery.
Regards,
SharePointKings...

Jayesh Prajapati said...

it will hide single upload from option... if it is ok with you then we can work on it and provide you...

Madhan said...

That was very useful.
Thanks for the idea.

Unknown said...

Indeed, I also told my boss from the beginning, you can upload any number of files including a single file using the multiple upload, so why does the single upload even exist?

But I have a library with 12 different views.
I do not feel like adding this script in each of them.
Is there a way to disable the single upload option in all views without having to add the same script in each library view?

Parth Patel said...

try to add script in master page

but that will disable from all the library.

Anonymous said...

This is wonderful. I made an anonymous access library for outside viewers and I did not want them to be able to upload any files into this particular library - I just want them to be able to access the New button.

Thank you a ton!




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com