Saturday, December 29, 2012 6:20 AMHi,
I have an ItemAdding event receiver attached to an OOB document library that redirects to an error page if the file being uploaded has a non-permissible file extension. The list of permissible file extensions is specific to this library and is not the same as the blocked file types defined in Sharepoint Central Administration.
The problem is the redirection to the error page doesn't happen when I am uploading multiple files (from the file upload page when STSUpld.UploadCtl is used), even though the event receiver is triggered. However, in case of uploading single file (from the file upload page where the basic file upload control is used) the page gets redirected to the error page. Here is the event receiver code:
public override void ItemAdding(SPItemEventProperties properties)
properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
properties.RedirectUrl = "/_layouts/FileCollaboration/FileCollaborationLandingPage.aspx";
Can anyone please suggest how to solve the redirection problem in case of multiple file upload?
- Edited by Farhan82 Sunday, December 30, 2012 9:00 AM
Sunday, December 30, 2012 8:54 PMHi Multiple file uploads make use of a ActiveX control. The parameters to this activex control need to be overridden in order to redirect the user to a specific page. Unfortunately this cannot be achieved using an event handler. The only way to do this is specified in http://blogs.technet.com/b/
sharepointdevelopersupport/. Here you will have to create your own custom page for uploading multiple documents. archive/2012/12/18/rerouting- users-to-a-custom-page-after- multiple-page-upload.aspx
Tuesday, January 01, 2013 2:42 PM
Thanks for the response Balaji. While the solution suggested in the blog post deals with the case where redirection to another (custom) page is required "after" file upload but is not for the case where rerouting is to happen "before" the file gets uploaded to the document library. That's why I chose ItemAdding event receiver. Since event receiver as you said cannot achieve this so is there any other approach to solve my problem?
Wednesday, January 02, 2013 7:11 AMfarahan can you try this http://sharepointsmfu.codeplex.com/
Wednesday, January 02, 2013 1:26 PM
The only approach is to create your own custom upload page, and write the code yourself. You cannot make use of the OOTB upload control in that case as far as I know.
- Marked As Answer by Qiao WeiMicrosoft Contingent Staff, Moderator Monday, January 07, 2013 2:01 AM