jeudi 29 janvier 2015

Link to the uploaded document in RichTextHtmlField is not generated if custom document upload form is used

I have a RichTextHtmlField in a page. The user who is entering data need to upload the document for reference. I want to change the selected option of Destination Library in the form. To do so, I have copied entire content of Upload.aspx page and created a custom action to launch the custom upload form. When I click on the custom action button I am getting the exact ouput which I want but after the upload operation completes I am not getting the link generated in the field area, as SharePoint OOTB upload form does.


My custom action contains following code:



<CustomAction Id="Ribbon.PublishTab.Publishing.Actions.UploadDocumentButton" Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.EditingTools.CPInsert.Links.Controls._children" >
<Button Id="Ribbon.PublishTab.Publishing.UploadDocumentButton1" Command="UploadDocumentButton1"
Image16by16="/_layouts/15/Solution/Images/Approval_16_by_16.jpg"
Image32by32="/_layouts/15/Solution/Images/Approval_32_by_32.jpg"
LabelText="Upload File" TemplateAlias="o1" Sequence="1000" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="UploadDocumentButton1" CommandAction="javascript:function test(){

var url = _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/DiscussionBoardEventReceiver/Pages/UploadFile.aspx?UseDivDialog=true&amp;LCID=1033&amp;Source=' + _spPageContextInfo.serverRequestPath +'&amp;AssetPageFolder=true&amp;seed=0.10343389471709208';
var options = {url: url};
SP.UI.ModalDialog.showModalDialog(options);

} test();">
</CommandUIHandler>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>


The page UploadFile.aspx the exact code which is found in Upload.aspx in \_layouts folder.


The file is uploaded successfully but the link is not getting generated. What am I missing?


Aucun commentaire:

Enregistrer un commentaire