Uploading a document - Amazon WorkDocs

Notice: New customer sign-ups and account upgrades are no longer available for Amazon WorkDocs. Learn about migration steps here: How to migrate data from Amazon WorkDocs.

Uploading a document

Amazon WorkDocs Content Manager provides an API for uploading content to an Amazon WorkDocs site. The following examples demonstrate 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();