Question

IMSunny on Mon, 25 Jul 2016 15:26:49


Hi,

I am looking for a way to have an "Add new document" link on one of my SharePoint pages to add documents to a document library. Can this be done? If yes, how?


Sponsored



Replies

Viral B Patel on Mon, 25 Jul 2016 16:40:12


Hi,

Please follow the steps here to add a link to SharePoint page.

http://www.babson.edu/offices-services/marketing/guidelines-templates/instructions/styling/Pages/inserting-links.aspx

Thanks,

Viral.

Andy JY on Tue, 26 Jul 2016 05:59:07


Hi,

According to your description, my understanding is that you want to add a link in one of sharepoint page that can upload documents to a document library.

We can achieve your needs via Content Editor Web Part.

1, Create a document library and go to Library Settings click Metadata navigation settings, then copy the list GUID

2, In a library document page, click F12 and use arrow select the New Document to know the onclick event.

The onclick event like:

Onclick=” NewItem2(event, "http://sp/sites/test/_layouts/15/Upload.aspx?List=the list GUID from step 1 &RootFolder="); return false;”

3, Edit a SharePoint Page and add a Content Editor Web Part, the code as below:

<a onclick="NewItem2(event,'http://sp/sites/test/_layouts/15/Upload.aspx?List=the list GUID from step 1&RootFolder='); return false;" href="/sites/test/_layouts/15/Upload.aspx?List=the list GUID from step 1&RootFolder=">Add New Document</a>

Here is a picture for the final rendering:

Best Regards,

Andy Wu




Rajesh.Sitaraman on Tue, 26 Jul 2016 06:10:47


Try to create a link with appropriate values

<a class="ms-addnew" id="idHomePageNewDocument" href="https://sharepoint.com/sites/PCs/_layouts/Upload.aspx?List={0DAB416D-AB62-489A-AEAA-798114AD244F}&amp;RootFolder=" onclick="javascript:NewItem2(event, &quot;https://office.bt.com/sites/PCs/KAL/_layouts/Upload.aspx?List={0DAB416D-AB62-489A-AEAA-798114AD244F}&amp;RootFolder=&quot;);javascript:return false;" target="_self">Upload new asset</a>

IMSunny on Thu, 28 Jul 2016 12:44:58


Dear Andy,

I am unable to locate "Onclick event" after selecting "new document" link -

If I click on "upload existing file" from New document call out, I get this -

And from the callout.js I cannot find any event (as shown by you) .

Andy JY on Mon, 01 Aug 2016 10:03:39


Hi,

I think you can try in the "Shared Document" and find the onClick event in tag of a.

Best Regards,

Andy Wu

IMSunny on Thu, 04 Aug 2016 14:45:12


I managed to do it like this -

<a onclick="javascript:NewItem2(event, &quot;/sites/Corp/_layouts/Upload.aspx?List=%7B2ED1F01B%2DCC71%2D4D0B%2DA1C5%2D6162FBB3F6CE%7D&amp;Source=http%3A%2F%2Fmyteam%2Ecom%2Fsites%2FCorp%2FIncident%2FForms%2FAll%2Easpx&amp;RootFolder=&amp;ContentTypeId=0x0101008F490C9073424C4B9B9DF003E836A90F00401C33900D12454AA94540A8C1040620&quot;);javascript:return false;" href="/sites/Corp/_layouts/Upload.aspx?List=%7B2ED1F01B%2DCC71%2D4D0B%2DA1C5%2D6162FBB3F6CE%7D&amp;Source=http%3A%2F%2Fmyteam%2Ecom%2Fsites%2FCorp%2FIncident%2FForms%2FAll%2Easpx&amp;RootFolder=&amp;ContentTypeId=0x0101008F490C9073424C4B9B9DF003E836A90F00401C33900D12454AA94540A8C1040620" target="_self">Add New Document</a> 

Andy JY on Fri, 05 Aug 2016 09:25:12


Hi,

Yes, you can have a test.

Please feel free to let me know if there is any other question.

Best Regards,

Andy Wu

Andy JY on Tue, 09 Aug 2016 02:08:22


Hi,

Is there any update for your issue?

Best Regards,

Andy Wu

IMSunny on Fri, 12 Aug 2016 12:23:26


Hi Andy,

Thanks for your follow up. As mentioned earlier; i managed to achieve it using -

<a onclick="javascript:NewItem2(event, &quot;/sites/Corp/_layouts/Upload.aspx?List=%7B2ED1F01B%2DCC71%2D4D0B%2DA1C5%2D6162FBB3F6CE%7D&amp;Source=http%3A%2F%2Fmyteam%2Ecom%2Fsites%2FCorp%2FIncident%2FForms%2FAll%2Easpx&amp;RootFolder=&amp;ContentTypeId=0x0101008F490C9073424C4B9B9DF003E836A90F00401C33900D12454AA94540A8C1040620&quot;);javascript:return false;" href="/sites/Corp/_layouts/Upload.aspx?List=%7B2ED1F01B%2DCC71%2D4D0B%2DA1C5%2D6162FBB3F6CE%7D&amp;Source=http%3A%2F%2Fmyteam%2Ecom%2Fsites%2FCorp%2FIncident%2FForms%2FAll%2Easpx&amp;RootFolder=&amp;ContentTypeId=0x0101008F490C9073424C4B9B9DF003E836A90F00401C33900D12454AA94540A8C1040620" target="_self">Add New Document</a>

Thanks again. Much appreciate your help on this.

Andy JY on Mon, 15 Aug 2016 02:22:58


Hi,

Thanks for your sharing.

Please mark my replies as answer if it is helpful to you.

Best Regards,

Andy Wu