Overview -
SharePoint Upload.aspx page is used for uploading documents from the document libraries and other lists. Upload.aspx is called, by passing various Query String parameters like ListId, Source, MultipleUpload etc. MultipleUpload parameter is used to display controls for single or multiple file upload. After uploading the documents, code redirection happens to AllItems.aspx or EditForm.aspx, based on scenarios. Since, redirection happens in code behind, creating custom application page to perform upload function and redirecting, serves the purpose. To start with, approach looks like, lot of development effort. However, it is very simple, since we are reusing the functionality provided in upload.aspx. This enables you to inject specific business rules and processes for adding files to the library. This also enables to write specific business processes as well custom file processing.
Code –
Creation of custom aspx page with code behind library. Instead of creating a completely new Upload page, you will derive from the existing Upload page and functionality and modifying the functionality you want. To do this, you reference the Microsoft.SharePoint and Microsoft.SharePoint.ApplicationPages assemblies in your project. Then you create a class that derives from the Microsoft.SharePoint.ApplicationPages.UploadPage class. This class uses the Microsoft.SharePoint and Microsoft.SharePoint.ApplicationPages namespaces. The functionality that we want is redirect the users to custom application page.
C# Code -
namespace UploadRedirect
{
public class CustomUpload : Microsoft.SharePoint.ApplicationPages.UploadPage
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
//Set the literal control text to redirect page.
this.ConfirmationURL.Text = { Complete Url to the Redirect Page }
}
}
}
Creating the ASPX Page –
Create new custom aspx page, based on Upload.aspx from Layouts directory. Add the reference of above creating assembly on the top of custom aspx page. Rest of the content remains the same. Deploy the assembly in Global Assembly Cache and custom upload aspx page in layouts directory. Test the page, by passing the same query string parameters as being passed in upload.aspx.
Redirecting the User to the New Upload Page -
Change the links for Upload and Multiple Upload in the Document Library. There can be different approaches for the same. Custom Document Library Template with the path to custom upload page, would be one of them. Using Javascript of overriding the links, can be another.
References -
Microsoft MSDN Article -
Preventing Record Modification but Allowing Metadata Modification by Overriding the Upload Page in Windows SharePoint Services 3.0
Through this blog, it is my effort to share experiences with the community and make the journey enjoyable.
Wednesday, August 20, 2008
Search This Blog
Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway. All posts are provided "AS IS" with no warranties, and confers no rights. In addition, my thoughts and opinions often change, and as a weblog is intended to provide a semi-permanent point in time snapshot you should not consider out of date posts to reflect my current thoughts and opinions.
Categories
- SharePoint ( 8 )
- #spfx ( 5 )
- #spfx-tooling ( 5 )
- #spfx-webparts ( 5 )
- SharePoint Framework ( 5 )
- Ionic ( 3 )
- Application Page ( 2 )
- Cordova ( 2 )
- Ionic 2 ( 2 )
- Mobile ( 2 )
- SharePoint 2010 ( 2 )
- SharePoint 2013 ( 2 )
- Software Methodologies ( 2 )
- WebPart ( 2 )
- Agile ( 1 )
- Auditing ( 1 )
- Best Practises ( 1 )
- Business Entities ( 1 )
- Custom Actions ( 1 )
- Enterprise Web 2.0 ( 1 )
- Feature ( 1 )
- List Rendering Template ( 1 )
- Office 365 ( 1 )
- People Picker ( 1 )
- SPD 2010 ( 1 )
- SaveButton ( 1 )
- SharePoint Designer 2010 ( 1 )
- SharePoint Event ( 1 )
- SharePoint India ( 1 )
- SharePoint Saturday ( 1 )
Popular Posts
-
Oracle Universal Content Management Integration with SharePoint using Web Parts WebParts to use Oracle ECM as backend and SharePoint as fro...
-
Introduction - SharePoint DataSheet Page is used for editing lists in multiple record grid format. DataSheet view uses ListNet control, w...
-
Introduction - Windows SharePoint Services 3.0 introduces built-in audit logging you can enable and configure at the scope of a site colle...
-
Overview - SharePoint Upload.aspx page is used for uploading documents from the document libraries and other lists. Upload.aspx is called,...
-
SharePoint 2013 provides client side people picker. Following snippet helps to set the form value using JQuery and validate the user. B...
-
While starting on design of SharePoint Custom applications, one of the dilemma which comes - Whether to use SharePoint lists as DataStore or...
-
Join SharePoint architects, developers, and other professionals from India that work with Microsoft Office SharePoint Server 2010 and 2007 f...
-
On creating new Ionic 2 project templates with Visual Studio 2015, build is failing with the Error (DEP10402) : Could not locate the star...
-
Microsoft Office SharePoint Designer is a free WYSIWYG HTML editor and web design program from Microsoft for SharePoint and other websites ...
-
' The load balancer is not provisioned. Verify the load balancer was provisioned successfully before retrieving endpoint addresses'...
I cannot get this to compile - it doesn't seem to recognize UploadPage as a namespace of Microsoft.SharePoint.ApplicationPages.
ReplyDeletePlease advise.
Thanks!
-Tracy
I am having trouble getting this to work. I have my reference to Microsoft.Sharepoint but, I keep receiving "UploadPage does not exist in the namespace" on Build?
ReplyDelete