Skip to Content
avatar image
Former Member

Loading files to a SharePoint document library (repository)

I am creating an SAPUI5 form and attempting to use the sap.ui.unified.FileUploader. I have a function that works great for SAP file uploads but fails when it is a destination of SharePoint 2013 with an error 500. I have searched server logs for the issue with no results. I can save my associated form elements from the form (such as numbers and changes to other tables that are data relevant) but not actual binary file uploads. In this case I have a form that will use a grid to display the list of links that support this particular form (a new document request) and the user can add 1 or more. My control is setup as follows within my view.xml file:" sendXHR="true" useMultipart="false" uploadComplete="updSuppComp" maximumFileSize="3000" additionalData="Upload"/>

The controller functions as called above are: /*================================================================ SUPPORTING DOCUMENT UPLOAD EVENTS =================================================================*/ onUpload: function(oEvent){ var uploader = this.byId("ui5uploader"); var updval = uploader.getValue(); if (updval==="" || updval===null || updval===undefined){ GenericFunctions.buildSAPMessageBox(this.oi18nVals.getText("msgboxFileUploadTitle"),this.oi18nVals.getText("msgboxFileUpload"), [sap.m.MessageBox.Action.OK],sap.m.MessageBox.Icon.WARNING); } else { this.omSharePoint.refreshSecurityToken(); var token = this.omSharePoint.getSecurityToken(); uploader.removeAllHeaderParameters(); var header = new sap.ui.unified.FileUploaderParameter({ name:"x-csrf-token", value:"Fetch" }); uploader.insertHeaderParameter(header); header = new sap.ui.unified.FileUploaderParameter({ name:"Accept", value:"application/json; odata=verbose" }); header = new sap.ui.unified.FileUploaderParameter({ name:"slug", value:"path=" + updval }); var fileMimeType =; uploader.insertHeaderParameter(header); header = new sap.ui.unified.FileUploaderParameter({ name:"Content-Type", value:fileMimeType }); uploader.insertHeaderParameter(header); this.getOwnerComponent().openBusyDialog(); uploader.upload(); }, updSuppComp: function(oEvent) { var sResponse = oEvent.getParameter("response"); if (sResponse) { var sMsg = ""; var isSuccess = sResponse.match(/Success/g); if (isSuccess !== null) { sMsg = "Return Code: SUCCESS Upload Success"; oEvent.getSource().setValue(""); } else { sMsg = "Return Code: ERROR Upload Error"; } GenericFunctions.buildSAPMessageBox("FileUpload",sMsg, [sap.m.MessageBox.Action.OK],sap.m.MessageBox.Icon.WARNING); },

I was hoping it would be just as cut and dry as the data uploads and SAP file uploads, but no such luck. Any help would be greatly appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

0 Answers