First published on TECHNET on Dec 17, 2012
This blog post is a contribution from Balaji Sadasivan, an engineer with the SharePoint Developer Support team.
Puzzle
In MOSS 2007 and SharePoint 2010 you can reroute the user to a custom page after they complete uploading documents to a document library to by changing the source parameter in the query string URL like what’s shown below:
http://[siteUrl]/_layouts/UploadEx.aspx?List=%7bD8358575-868E-47D6-A188-77607D7D4549%7d&RootFolder=&Source=http%3a%2f%2fbalaji-2srv%3a1983/SitePages/Home.aspx
However be sure to remove an additional parameter &IsDlg from the query string for this to work.
This also holds true for uploading multiple documents in SharePoint MOSS 2007. But in SharePoint 2010 we are using an ActiveX control that is not allowing users to be routed to a custom page after uploading multiple documents.
Cause
In the SharePoint 2010 UploadEx.aspx page calls the UploadCtl ActiveX and hardcodes the URL to the library URL followed by AllItems.aspx. Hence varying the source parameter doesn’t work in this scenario.
Solution
Create a custom upload page.
Here we pass the rerouting parameter to a web UploadCtl via a hidden field. Change the value of this parameter to whatever is required by you.
You can rename this file as UploadEx.aspx after backing up the original, or provide an http module that will redirect the user to this page when UploadEx.aspx is called.
Full Code
Full code attached as a separate ASPX file. Download
Welcome to the SharePoint Blog! Learn best practices, news, and trends directly from the SharePoint team.