Solved

Create an "Upload a Document" button web part in other document libaries

Posted on 2013-01-15
3
3,349 Views
Last Modified: 2013-01-17
1. Created a subsite and used the "Document Center" template.
2. Exported the "Upload a Document" button from that site.
3. Uploaded the button web part to the Web Part Library.
4. On the Home page I added the "Upload a Button" web part.
5. The button works on the subsite fine.
6. On the home page the button will not open the "upload.aspx" page.

Here is a copy of the code for the button. They are exactly the same for both the home page and subsite.

<div class="ms-uploadbtnlink"><button onclick="javascript:OpenNewFormUrl(&#39;DropOffLibrary/Forms/upload.aspx&#39;);return false;" type="submit"><nobr><img alt="Upload a Document" src="/_layouts/Images/uploaddoc.png"/>&#160;<span>Upload a Document</span></nobr></button> </div>
0
Comment
Question by:mnoisette
[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
3 Comments
 
LVL 11

Expert Comment

by:Guru Ji
ID: 38780222
You just have to specify the entire path for the form URL for upload.aspx in the home page.
For instance your website URL is

myintranet/home

and your subsite is

myintranet/departments/IT

then currently your upload for subsite pointing to
myintranet/departments/IT/DropOffLibrary/Forms/upload.aspx

you have to give FULL path on the code above
so that it knows which department or subsite library you trying to upload too.

Currently the URL is translated to

myintranet/DropOffLibrary/Forms/upload.aspx

and thats why it does not work
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 38780306
Hi,
this is because the function "OpenNewFormUrl" is only defined on the doc center page (and not on the root site home page).

Thats the function in the doc center:
function OpenNewFormUrl(url)
{
	var options = {width:720, height:480};
	SP.UI.ModalDialog.commonModalDialogOpen(url, options, null, null);
}

Open in new window


Either you add the function to your home page or you recode the button click:
<button onclick="javascript:var options = {width:720, height:480};SP.UI.ModalDialog.commonModalDialogOpen('/DropOffLibrary/Forms/upload.aspx', options, null, null);return false;" type="submit">

Open in new window


Please be sure and check the Url of the DropOffLibrary.

HTH
Rainer
0
 

Author Closing Comment

by:mnoisette
ID: 38789689
Worked like a charm!
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision Office 365 tenants, synchronize your on-premise Active Directory, and implement Single Sign-On.

Question has a verified solution.

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

Suggested Solutions

If you create your solutions on SharePoint sooner or later you will come upon a request to set  permissions of the item depending on some of the item's meta-data - the author, people assigned as approvers, divisions, categories etc. The most natu…
Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 do not offer the option to configure the location of the SharePoint diagnostic trace log files during installation.  This can, however, be configured through Central Administr…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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