Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

When using Announcements or Discussion forms it's possible to upload a document when entering data into the body field. (The editing tools are available and when clicking on the insert tab the Upload file option appears)

Is it possible to adjust the upload form to use a defined fixed upload location. E.g. The dropdown list is "Upload To" only shows "Shared Documents" And this only for certain content types? (E.g. Announcements list, Discussion list, etc.)

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Basically the dropdown, lists all the document libraries in a site that you have access to.

You will have to change the "RteUploadDialog.aspx" in the Layouts folder in the 14 hive to accomplish this. Search for the Dropdown "TargetList" and add a line similar to the code below to get the document library you wish to get selected. Here I have made "Documents" Library as my default selected value.

<asp:DropDownList id="TargetList" onchange="CheckUniquePermissions(this.options[this.selectedIndex].value);" Width="320px" runat="server" DataTextField="Documents">
<asp:ListItem Selected ="True" Text="Documents" Value="2fd2a13d-3c11-4bf0-8638-6ddfd45c35cb"></asp:ListItem>
</asp:DropDownList>

The ID of the library can be retrieved by getting the view source of the popup page. Everything should work fine, but I would not recommend editing the core files inside the layouts folder which could breach your warranty with Microsoft.

share|improve this answer
    
Thanks Deepu, Is there no option to put this in a feature/solution and overwrite the default "Upload File" behavior? (Hide the original upload button and replace it with a custom one with code behind that starts from a copy of the RteUploadDialog.aspx") –  Wim Hill May 16 '12 at 11:30
    
Create this as a separate page in layouts folder and check out the option to use SPWebApplication.UpdateMappedPage - msdn.microsoft.com/en-us/library/… or try writing an httpmodule which could intercept user requests and redirect to the custom aspx page. –  Deepu Nair May 16 '12 at 11:47
    
Is it possible to do this only for one specific site collection? –  Wim Hill May 16 '12 at 13:46
    
SPWebApplication.UpdateMappedPage is implemented for a single web application. Your custom code in an httpmodule can be logically formulated to check only the specific site collection that you desire. –  Deepu Nair May 16 '12 at 16:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.