Source Redirect After Uploading Multiple Documents

There are times where you want to control how the page flow works during and after the document upload process.  The simplest path that this takes is:

  • from a view in the Document Library, clicking on the Upload button
  • which takes you to _layouts/Upload.aspx where you specify the document you want to upload
  • then to the EditForm.aspx to enter the metadata for the document
  • then back to the Document Library view you started on

The way SharePoint “knows” which page to return you to is the Source Query String Parameter.  In the case above, the Source will be the Document Library view you started from, perhaps something like this (note that certain characters are encoded):


You might want to place links elsewhere in your site which takes the user to the document upload page without having to visit the Document Library itself or expose the toolbar on a List View Web Part. To do this, you can simply place a link like this anywhere you want it (carriage returns added for easier reading):


If you want to take the user directly to the multiple documents upload page, all you need to do is add this parameter to the Query String: MultipleUpload=1, like this:


There’s one bugaboo in this: the Source needs to be an absolute URL, not a relative one. If you specify a relative URL, you will be taken to the right page, but the multiple document upload page won’t function. When you click on the OK button, nothing will happen.

So this:


is good, and this:


is bad.

As I’ve posted before, you can pass additional parameters with the Source by including them in the URL like this:


Note that to do this, you need to have your Source Query String parameter in the last position in the URL.  This is required due to the ? you need to pass the additional parameters on the Source redirect URL.

Passing Query String Values as Part of the Source Query String Parameter in SharePoint

SharePoint has a nice capability on many pages where, if you pass a Query String parameter named Source with a value of a page URL, the user is returned to that page when they are done with the activity.  An example would be when a user clicks on an ‘Add new document’ list on a site where they are a contributor.  The current page’s URL is specified as the Source parameter, and when the user is done adding the document, they return to the current page.

There are times when you’re sending your user off from a page that relies on its own Query String values to configure it.  So, how do you pass those values along with the source so that when the user gets back, they see the page configured correctly?  The trick is a little encoding magic.  Configure your URL to look like something like this:

<a href="{concat('/PG/Policy%20Guidance/Forms/DispForm.aspx?ID=', @ID,
         '&Source=', $URL,
         '?Series=', $Series,
         '%26ContentArea=', $ContentArea)

This will evaluate to something like this URL:


By placing a question mark (?) after the Source URL value and encoding the ampersand (&) between parameter/value pairs as %26, you can ensure that those values are passed back to the Source URL when the user returns to that page.  This will also work if you are building your own forms and are using the ddwrt:GenFireServerEvent(‘__redirectsource;’) function.

Technorati tags: , ,