Amazon WorkDocs
Developer Guide

Uploading a Document

Amazon WorkDocs Content Manager provides an API for uploading content to a Amazon WorkDocs site easily. The following are examples of how to upload a document using Java and C#.

Java

File file = new File("file-path"); InputStream stream = new FileInputStream(file); UploadDocumentStreamRequest request = new UploadDocumentStreamRequest(); request.setParentFolderId("destination-folder-id"); request.setContentType("content-type"); request.setStream(stream); request.setDocumentName("document-name"); contentManager.uploadDocumentStream(request);

C#

var stream = new FileStream("file-path", FileMode.Open); UploadDocumentStreamRequest uploadDocumentStreamRequest = new UploadDocumentStreamRequest() { ParentFolderId = "destination-id", DocumentName = "document-name", ContentType = "content-type", Stream = stream }; workDocsContentManager.UploadDocumentStreamAsync(uploadDocumentStreamRequest).Wait();