Newer Version Available
completeFileUpload(repositoryId, inputRep)
Once all parts are uploaded successfully, the process is finalized in Salesforce by
invoking the completeFileUpload method. It returns an outputRep instance that indicates the
completion status of the file.
Parameters
- repositoryId
- Type: String
-
The ID of the repository.
- inputRep
- Type: Map<String,ANY>
-
Enter the input Representation instance created with ConnectApi.ContentHubUploadItemInputRepresentation();
- Sample Code Snippet
-
1@AuraEnabled(cacheable=false) 2 public static ConnectApi.ContentHubCompleteUploadRepresentation completeFileUpload(String fileId, String fileName, String contextId, String contentType, String uploadId, List<ConnectApi.ContentHubUploadPartsInputRepresentation> uploadParts, String repositoryId) { 3 try{ 4 ConnectApi.ContentHubCompleteUploadInputRepresentation inputRep = new ConnectApi.ContentHubCompleteUploadInputRepresentation(); 5 inputRep.fileId = fileId; 6 inputRep.fileName = fileName; 7 inputRep.contextId = contextId; 8 inputRep.contentType = contentType; 9 inputRep.uploadParts = uploadParts; 10 inputRep.uploadId = uploadId; 11 final ConnectApi.ContentHubCompleteUploadRepresentation outputRep = ConnectApi.ContentHubFileUploadConnect.completeFileUpload(repositoryId, inputRep); 12 System.debug('Content Version Id: ' + outputRep.contentVersionId); 13 14 return outputRep; 15 } 16 catch(Exception ex) { 17 throw new AuraHandledException('Error in completeFileUpload: ' + ex.getMessage()); 18 } 19 }