Following the Part 1 of the Sharepoint 2010 s Upload Multiple Documents in Silverlight article, I had let some issues unsolved.
- When a user clicks on Upload Document, the standard upload page is loaded but sill contains the link to the OOTB multiple upload page (uploadex.aspx)
- If a user does not have office installed, this link won’t appear.
1. When a user clicks on Upload Document, the standard upload page is displayed and contains the link to the standard multiple upload page (uploadex.aspx?Multipload=true) and not our custom MultipleUpload page developed in the Part 1 on this article.
2. The second issue is linked to the first issue, the link to the standard multiple upload page appears based on the same rule than the Upload Multiple Documents ribbon button, you need Office installed.
To overcome both issue, what I propose in this article, is to provide our own uploadex.aspx page.
This workaround(let s be honest and call it that way) will consist of two steps:
– create a custom version of the uploadex.aspx
– create a httphandler to redirect to this custom uploadex.aspx page
Create a custom version of the uploadex.aspx
To create a custom version of the uploadex.aspx, proceed as follows:
- copy the standard uploadex.aspx (_layouts folder) page and rename it to CustomUploadex.aspx
- create a class called CustomUploadex, this class must inherits from Microsoft.Office.RecordsManagement.PolicyFeatures.ApplicationPages.UploadExPage ( assembly : C:\inetpub\wwwroot\wss\VirtualDirectories\80\_app_bin\Microsoft.Office.Policy.Pages.dll)
In this newly created class, overrides the onload event to add the following code.
As you can see, we are setting a custom url for the UploadMultipleLink, this url points on the custom mutliple upload page created in the part 1.
Change the default inherits properties to point on your newly created class. Be sure this line figure at the top of the CustomUploadEx.aspx file.
<%@ Assembly Name=”SPMU, Version=184.108.40.206, Culture=neutral, PublicKeyToken=99a1297ff3a95a0c”%>
Create a httphandler to redirect to CustomUploadex.aspx page
do not fourget to put your feature a safecontrol if you do not do that, the HttpModule will not be attached
Your must add the following line under <modules runAllManagedModulesForAllRequests=”true”> into the web.config also to wire our httpmodule, this could be done using a feature and the SPWebConfigModification API but it’s out of the scope of this article.
<add name=”MyHttpModule” type=”SPMU.MyHttpModule, SPMU, Version=220.127.116.11, Culture=neutral, PublicKeyToken=99a1297ff3a95a0c” />
Now when requesting the original upload page, our custom page will be called.
Here are the full source of both part 1 and 2.
gl & hf